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