First of all, when we set up the lamp environment, the Apache server default site installation directory is /var/www/html
However, we build the project for convenience, we are in accordance with their own wishes to change the site Directory
Now suppose that the site directory that you set as desired is /data/httpd
Method:
First step: Create/DATA/HTTPD
Open Terminal input:
Mkdir/dadacd/datamkdir httpd
Step two: Change the Apache configuration
Open Terminal input:
Vim/etc/httpd/conf/httpd.conf
Find DocumentRoot "/var/www/html" #apache的根目录
Change the/var/www/html directory to/DATE/HTTPD
Find <directory "/var/www/html" > #定义apache/var/www/html this area
Change the/var/www/html into a//date/httpd/.
Save exit so that the default project path is changed to/DATA/HTTPD
Step three: Restart the Apache server
Open Terminal input
/ETC/INIT.D/HTTPD restart
Enter, Finish, test
Possible problems encountered: Test Access Denied!!
Mainly because your/data/httpd permissions are 750,apache This user does not have permission to access, need to modify the permissions, you can change
Open Terminal: input, enter
Chmod-r 755/data/httpd
And then went to the test and found it worked.
At this point, the Apache default site directory changes successfully.
Change the Apache Default Web site installation directory under CentOS 6.8