Under CentOS the APAHCE Web site root directory is installed under/var/. The mount point is out of space, so we have to change the position to/home/www.
Switch to this directory and restart Apache. Also give this directory 777 permissions, but access is to appear 403
Search on the Internet, and finally found the following command:
The code is as follows |
Copy Code |
Chcon-r-T Httpd_sys_content_t/home/www |
Run it again, it's normal!
It is said that this is the cause of selinux, do not understand. Just keep the record!
The following steps are attached to the switch directory
1, vi/etc/httpd/conf/httpd.conf
finds the DocumentRoot "/var/www/html" section #apache的根目录
Change/var/www/html this directory to/home/ Wwwroot/web1/htdocs
Then find <directory "/var/www/html" > #定义apache/var/www/html this area
to convert/var/www/html to/home/ Wwwroot/web1/htdocs
So we apahce the default path to the
service httpd restart #重启Apache服务器
2, access to the localhost, you will find access denied, What is this for?
System Operation Dimension Warm reminder: qihang01 original content copyright, reprint please specify the source and the original link
is mainly because your/home/wwwroot/web1/htdocs permission is 750,apache This user does not have the privilege to access, You need to get rid of the permissions, you can change the
chmod-r 755/home/wwwroot/web1/htdocs
and then go to the discovery that the normal run (Apache User: Apache run Apache Group: Apache)
So far , the Apache default site directory changes successfully.