Apache default http://www.aliyun.com/zixun/aggregation/9324.html "> Web directory is in/var/www/html
We are now going to change the site directory to/home/wwwroot/web1/htdocs
To create a directory:
Cd/home
mkdir wwwroot
CD Wwwroot
mkdir Web1
CD Web1
mkdir Htdocs
Touch index.php
Operation Steps:
1, vi/etc/httpd/conf/httpd.conf
Find the DocumentRoot "/var/www/html" #apache的根目录
Change the/var/www/html directory to/home/wwwroot/web1/htdocs.
and find <directory "/var/www/html" > #定义apache/var/www/html this area.
Change the/var/www/html to/home/wwwroot/web1/htdocs
So we can get rid of APAHCE's default path.
Service httpd Restart #重启Apache服务器
2, visit the localhost, will find the access denied, this is why?
Mainly because of your/home/wwwroot/web1/htdocs permission is 750,apache This user does not have the privilege to access, you need to change the permission, can like this
Chmod-r 755/home/wwwroot/web1/htdocs
Chown apache.apache/home/wwwroot/-R
And then go to a visit to find the normal run (Apache User: Apache run Apache Group: Apache)