2016-10-19 4 views
0

У меня настроить centos7 в VirtualBox, в котором работает, Apache HTTPD, MariaDB, PHPMyAdmin и т.д., хозяин MacOSапач HTTPD карта URL в общую папку VirtualBox

при попытке сопоставить URL в общую папку, я встречается ошибка

Forbidden: You don't have permission to access /tutorial/ on this server. 

Судо хвост -f/вар/Журнал/HTTPD/error_log

[Wed Oct 19 22:48:23.108758 2016] [autoindex:error] [pid 1469] (13)Permission denied: [client 192.168.144.1:51847] AH01275: Can't open directory for index: /php-tutorial/www/ 

/etc/httpd/conf.d/tutorial.conf

Alias /tutorial "/php-tutorial/www" 

<Directory "/php-tutorial/www"> 
    Options Indexes FollowSymLinks 
    AllowOverride None 
    Require all granted 
</Directory> 

разрешения папки

drwxr-xr-x. 1 vagrant vagrant system_u:object_r:vmblock_t:s0 /php-tutorial/www 
drwxr-xr-x. 1 vagrant vagrant system_u:object_r:vmblock_t:s0 /php-tutorial 
drwxr-xr-x. root root system_u:object_r:httpd_sys_content_t:s0 /var/www 
drwxr-xr-x. root root system_u:object_r:httpd_sys_content_t:s0 /var/www/html 

Я не уверен, возможно ли это, и если возможно, то, что правильный способ настроить его.

ответ

0

Спасибо за Эзра-s для выделения возможных проблем.

Да, это из-за SELinux, потому что SELinux по умолчанию включен в Centos 7.2, который является гостевой ОС, используемой здесь.

Есть два различных решения этой проблемы:

  1. Быстрое решение, отключить SELinux

    # vi /etc/selinux/config 
    
    SELINUX=enforcing # <= change enforcing to disabled 
    
  2. Лучше решение, настроить политику SELinux

    # yum install -y policycoreutils-python 
    # vi httpd_t.te 
    
    module httpd_t 1.0; 
    
    require { 
         type httpd_t; 
         type vmblock_t; 
         class file { read getattr open }; 
    } 
    
    #============= httpd_t ============== 
    allow httpd_t vmblock_t:file { read getattr open }; 
    
    # checkmodule -M -m -o httpd_t.mod httpd_t.te 
    # semodule_package -o httpd_t.pp -m httpd_t.mod 
    # semodule -i httpd_t.pp 
    # systemctl restart httpd 
    

Литература:

  1. https://github.com/mitchellh/vagrant/issues/6970, кто-то столкнулся с той же проблемой и нашел выход шаг за шагом.
  2. https://wiki.centos.org/HowTos/SELinux, хорошее представление о SELinux.
0

Вы, кажется, есть SELinux, просмотрите журналы SELinux

 Смежные вопросы

  • Нет связанных вопросов^_^