linux - 如何禁用 Apache 中的目录列表?

标签 linux apache

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/

相关文章:

apache - 如何重定向所有 https ://requests to a subdomain on the server

Apache htaccess 西类牙口音

apache - 如何正确地对单页 Web 应用程序进行基准测试/压力测试

python - 如何让我的 Python 模块在 Linux 系统范围内可用?

linux - 需要帮助编辑脚本

计算在 Linux 中 I2C 上写入和读取之间的延迟

linux netfilter 将数据包内容传递给用户空间套接字应用程序

将所有文件和文件夹上传到 FTP 服务器的 PHP 脚本

javascript - Apache cordova - 无法写入android中的文件

linux - 适用于 Fedora 37 的 flutter