Apache 是否有一个选项可以全局禁用目录列表? (但它仍然允许我使用index.php作为我的主页)
注意:我有很多虚拟主机和子域等等。
最佳答案
是的,有可能。您应该将 Options 指令与 -Indexes 参数一起使用
例如,在 Centos 中/etc/httpd/conf/httpd.conf 将 目录/ 更新为:
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
<Directory />
Options FollowSymLinks -Indexes
AllowOverride None
</Directory>
这样所有子配置都将启用此限制。
请注意,如果指令 AllowOverride 设置为 Indexes 或 All(此效果会覆盖 .htaccess 文件中的参数),则每个子级都可以覆盖此设置
关于linux - 如何禁用 Apache 中的目录列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26101344/