【发布时间】:2019-07-16 20:49:08
【问题描述】:
我觉得这个问题之前一定有人问过,但我找不到任何东西。
如果我有一个带有两个独立 <Directory> 指令的简单 VirtualHost:
<VirtualHost *:80>
...
<Directory /var/www>
Require all granted
Options -Indexes
</Directory>
<Directory /var/www/api> # does the order matter?
Require local
Options -Indexes # is this redundant?
</Directory>
...
</VirtualHost>
我的问题是:
- 指令的顺序重要吗?如果
/var/www/api指令先出现会怎样? - 第二个
Options -Indexes是多余的吗? - 因为
/var/www/api是/var/www的子目录,所以设置级联?
【问题讨论】:
-
您为什么不简单地尝试一下呢?您投入几分钟的问题。
-
你至少读过documentation吗?
If multiple (non-regular expression) <Directory> sections match the directory (or one of its parents) containing a document, then the directives are applied in the order of shortest match first, interspersed with the directives from the .htaccess files. For example…。 Another explanation 在文档中。
标签: .htaccess http server virtualhost apache2.4