Change the Apache Default Web site installation directory under CentOS 6.8

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.