How to change the default Web site directory in Apache

Source: Internet
Author: User
Keywords Web Directory Apache
Tags aliyun apache change create default directory find how to

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)

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.