Search code examples
phpapachecentos6

Access permission in apache server CentOS


I have installed a virtual machine CentOS 6.6. I also installed Apache, PHP, MySQL with yum.

I changed my document root from /var/www/html to /www so I edited my /etc/httpd/httpd.conf and changed these two lines:

DocumentRoot "/var/www/html"

<Directory "/var/www/html"> 

I restarted apache and it was okay.

The problem occurred when I tried to open http://192.168.199.90/phpinfo.php. I got:

Forbidden You don't have permission to access /phpinfo.php on this server.

I tried to disable SElinux in /etc/selinux/conf and change enforcing to disabled

I also tried this: chcon -v -R --type=httpd_sys_content_t /www/

And when I write ls -laZ /www, I have:

drw-rw-rw-. www  www  unconfined_u:object_r:httpd_sys_content_t:s0 .
dr-xr-xr-x. root root system_u:object_r:root_t:s0      ..
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 phpinfo.php
drw-rw-rw-. www  www  unconfined_u:object_r:httpd_sys_content_t:s0 sites

Solution

  • Thank you all , i resloved it,

    I changed the Current mode of SElinux from enforcing to permissive by wrinting in the terminal :

    setenforce 0

    so when i write

    getenforce i get Permissive

    I did also chmod 755 -Rf /www

    ;)