使用 Server C 為 httpd Server 範例:
1. Server C 上執行 httpd ,並為 www-x.lab.example.com 網域提供服務來至 /srv/www-x.lab.example.com/www/ 其目錄內容 。
2. 其他網域來至 /srv/default/www/ 期目錄內。
[[email protected] ~]# semanage fcontext -a -t httpd_sys_content_t '/srv(/.*)?'[[email protected] ~]# restorecon -Rv /srv/Relabeled /srv/default from unconfined_u:object_r:var_t:s0 to unconfined_u:object_r:httpd_sys_content_t:s0
Relabeled /srv/default/www from unconfined_u:object_r:var_t:s0 to unconfined_u:object_r:httpd_sys_content_t:s0
Relabeled /srv/default/www/index.html from unconfined_u:object_r:var_t:s0 to unconfined_u:object_r:httpd_sys_content_t:s0
Relabeled /srv/www-x.lab.example.com from unconfined_u:object_r:var_t:s0 to unconfined_u:object_r:httpd_sys_content_t:s0
Relabeled /srv/www-x.lab.example.com/www from unconfined_u:object_r:var_t:s0 to unconfined_u:object_r:httpd_sys_content_t:s0
Relabeled /srv/www-x.lab.example.com/www/index.html from unconfined_u:object_r:var_t:s0 to unconfined_u:object_r:httpd_sys_content_t:s0