Centos

虛擬主機僅在 SELinux 設置為 permissive 時才有效 - 為什麼?

  • August 16, 2016

想知道為什麼我的虛擬主機只有在 SELinux 設置為“permissive”時才能工作。當 SELinux 設置為“強制”時,我的虛擬主機將被忽略並顯示預設主機。

Apache/2.2.15 (Unix)

這是我的 httpd.comf: http: //pastebin.com/2LRzLZ8Z

虛擬文件包含:

<VirtualHost *>
   DocumentRoot "/srv/vhosts/foo.com/htdocs"
   ServerName mysite.com
   <Directory "/srv/vhosts/foo.com/htdocs">
       allow from all
       Options +Indexes
   </Directory>
</VirtualHost>

作品:

SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   permissive
Mode from config file:          enforcing
Policy version:                 24
Policy from config file:        targeted

不起作用:

SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   enforcing
Mode from config file:          enforcing
Policy version:                 24
Policy from config file:        targeted

快速而骯髒的修復

# chcon -R -u system_u -t httpd_sys_content_t /srv/vhosts

你可以在這里這裡閱讀更多

引用自:https://unix.stackexchange.com/questions/145989