Does Apache have an option to disable directory listing globally? (But it will still allow me to use index.php as my main page)
Apache是否可以选择全局禁用目录列表? (但它仍然允许我使用index.php作为我的主页)
Note: I have many virtual hosts and subdomains and what not.
注意:我有许多虚拟主机和子域,什么不是。
1 个解决方案
#1
1
Yes, its possible. You should use the Options directive with the -Indexes param
是的,它可能。您应该将Options指令与-Indexes参数一起使用
For example, in Centos /etc/httpd/conf/httpd.conf update Directory / to:
例如,在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>
This way all child configuration will enhirit this restriction.
这样,所有子配置都会限制此限制。
Note that each child can override this if the directive AllowOverride is set to Indexes or All (This effect override params in .htaccess files)
请注意,如果指令AllowOverride设置为Indexes或All(此效果覆盖.htaccess文件中的参数),则每个子项都可以覆盖此项。
#1
1
Yes, its possible. You should use the Options directive with the -Indexes param
是的,它可能。您应该将Options指令与-Indexes参数一起使用
For example, in Centos /etc/httpd/conf/httpd.conf update Directory / to:
例如,在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>
This way all child configuration will enhirit this restriction.
这样,所有子配置都会限制此限制。
Note that each child can override this if the directive AllowOverride is set to Indexes or All (This effect override params in .htaccess files)
请注意,如果指令AllowOverride设置为Indexes或All(此效果覆盖.htaccess文件中的参数),则每个子项都可以覆盖此项。