semanage fcontext -a -t httpd_sys_content_t '/srv/www(/.*)?'

Category: Security & Hardening

semanage fcontext -a -t httpd_sys_content_t '/srv/www(/.*)?'

Define a SELinux file context rule

Tells SELinux that files under /srv/www should carry the httpd_sys_content_t type, the label web servers may read. The regex (/.*)? covers files and subdirectories. Context rules do not apply until you run restorecon -Rv /srv/www.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.