![Apache - 不提供根目录服务](https://linux22.com/image/1478991/Apache%20-%20%E4%B8%8D%E6%8F%90%E4%BE%9B%E6%A0%B9%E7%9B%AE%E5%BD%95%E6%9C%8D%E5%8A%A1.png)
我试图阻止 apache 为我的根目录提供服务,但将“拒绝所有”设置为<Directory />
也会阻止 apache 为 /var/www/html 提供服务。即使在配置中允许访问该目录。
Apache 配置文件:
<Directory />
AllowOverride None
</Directory>
DocumentRoot "/var/www/html"
#
# Relax access to content within /var/www.
#
<Directory "/var/www">
AllowOverride None
# Allow open access:
Require all granted
</Directory>
# Further relax access to the default document root:
<Directory "/var/www/html">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Require all granted
Options -Indexes
</Directory>