【发布时间】:2020-03-19 14:27:56
【问题描述】:
在我的 Apache 2.4 VirtualHost 配置中,我想 - 默认情况下 - 拒绝访问 DocumentRoot 中我未明确启用的所有内容。为此,我写了:
DocumentRoot /var/www
<Directory "/var/www">
Require all denied
<Files "index.html">
Require all granted
</Files>
</Directory>
这允许直接访问http://myserver.example/index.html,但会导致403 响应间接访问http://myserver.example/。
我该如何纠正这种行为?
【问题讨论】:
-
它的行为似乎完全如你所愿:你没有明确允许
/,所以它是被禁止的 -
@Dusan :谢谢,这让我走上了正轨,请看答案!原因我还不清楚,但我至少找到了一个切实可行的解决方案。