“为什么?”;“要求全部拒绝”;在apache2.conf中是否适用于所有子目录?

“为什么?”;“要求全部拒绝”;在apache2.conf中是否适用于所有子目录?,apache,require,Apache,Require,我想了解这种对我来说毫无意义的行为 apache2.conf在底部有默认配置 如您所见,它为/var/www提供了“Require all denied”和“Require all grated”/ 我在/var/www/HM下有一个网站/ 使用URL重写后,要求Apache发送例如/var/www/HM/subdir的结果/ 它拒绝访问,而不是正确返回位于subdir中的index.php的内容。我发现apache2.conf中的/“Require all denied”配置是罪魁祸首,但这对

我想了解这种对我来说毫无意义的行为

apache2.conf在底部有默认配置

如您所见,它为/var/www提供了“Require all denied”和“Require all grated”/

我在/var/www/HM下有一个网站/

使用URL重写后,要求Apache发送例如/var/www/HM/subdir的结果/

它拒绝访问,而不是正确返回位于subdir中的index.php的内容。我发现apache2.conf中的/“Require all denied”配置是罪魁祸首,但这对我来说没有意义,特别是当/var/www中给出了“Require all grated”时/

我已经设法为/var/www/HM/设置了“requireall-grated”,然后它似乎就开始工作了。但我仍然想理解为什么apache2.conf中的/directive适用于下面的所有内容,而/var/www/directive不适用

另外,如果/var/www/的指令不适用于子目录,我想知道/var/www/HM/的指令是否适用于它自己的子目录

谢谢你的帮助

# Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
    Options FollowSymLinks
    AllowOverride All
    Require all denied
</Directory>

<Directory /usr/share>
    AllowOverride All
    Require all granted
</Directory>

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>
#设置Apache2 HTTPD服务器的默认安全模型。是的
#不允许访问/usr/share和/var/www之外的根文件系统。
#前者由Debian中打包的web应用程序使用,
#后者可用于web服务器提供服务的本地目录。如果
#您的系统正在为/srv中您必须允许的子目录中的内容提供服务
#访问此处或任何相关虚拟主机。
选项如下符号链接
允许超越所有
要求全部拒绝
允许超越所有
要求所有授权
选项索引跟随符号链接
允许超越所有
要求所有授权