The Apache DocumentRoot point to the workaround for the Htcdoc 403 error _linux

Source: Internet
Author: User
Later found that the original Apache is not configured Well, is the Apache Mod_authz_host module in the control role.
1. If vhosts is not enabled
Just modify httpd.conf
The default directory section is as follows, note the Red section, which indicates that directory/usr/local/apache/htdocs allows all hosts to access
Copy Code code as follows:

<directory "/usr/local/apache/htdocs" >
#
# Possible values F Or the Options directive are ' None ', ' All ',
# or any combination of:
# Indexes Includes followsymlinks SymLink Sifownermatch execcgi multiviews
#
# "MultiViews" must be named to *explicitly*---"Options all"
# doesn ' t give it to you.
#
# The Options directive is both complicated and important. Please, the
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
#Options Indexes followsymlinks
#
# allowoverride Controls What directives may is placed in. htacc ESS files.
# It can be ' all ', ' None ', or any combination of the keywords:
# Options FileInfo authconfig Limit
#
allowoverride None
#
# Controls who can get stuff to this server.
#
Order Allow,deny
Allow to all
</Directory>

Because the home directory is pointed elsewhere, it's OK to replace the blue part/usr/local/apache/htdocs with your new home directory.
2. Enable Vhosts
Enable vhosts, you can not make the above modification, because VirtualHost can configure this section of the properties, so we virtualhost this section of the configuration of the words is more convenient, the following configuration, I put my site in/var/vhosts/ Www.test.cn under.
Copy Code code as follows:

/usr/local/apache/conf/extra/httpd-vhosts.conf
<virtualhost *:80>
<directory "/var/vhosts/www.test.cn" >
#Deny from all
Allow from all
</Directory>
DocumentRoot "/var/vhosts/www.test.cn"
ServerName www.test.cn
</VirtualHost>

If you remove the comment for deny from all, the server rejects all access (and we just started moving the home directory outside of Htdocs without making any configuration changes, haha)
Add one point:
If you are writing a index.php placed in the directory to test, you should pay attention, remember to add the default homepage index.php
DirectoryIndex index.html index.php

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.