Allowing access on Apache CentOS server

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

.

I changed my document root from /var/www/html

to /www

so I edited mine /etc/httpd/httpd.conf

and changed these two lines:

DocumentRoot "/var/www/html"

<Directory "/var/www/html"> 

      

I restarted apache and everything was fine.

The problem came up when I tried to open http://192.168.199.90/phpinfo.php

. I got:

Forbidden You do not have permission to access /phpinfo.php on this server.

I tried to disable SElinux in /etc/selinux/conf

and change enforcing

todisabled

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

      

+3


source to share


3 answers


Thanks everyone, I put it off,

I changed the current SElinux mode from enforcing

to permissive

by swiping in terminal:

setenforce 0

so when i write



getenforce

I get permissive

I also did chmod 755 -Rf / www

;)

+1


source


Edit the httpd.conf file located in /etc/httpd/conf/httpd.conf. Add the code below.



<Directory "/var/www/html">
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride None
Allow from all
</Directory>

      

0


source


Try:

chown -R apache:apache /www

      

or

chown -R www-data:www-data /www

      

BTW, never turn offSElinux

0


source







All Articles