September 13, 2020
Linux: 如何在Apache中禁用目录列表, Apache禁止显示目录列表, How to disable directory listing in Apache

目录清单Apache由AutoIndex模块提供。如果启用,并且Apache下特定路径或文件夹中没有DirectoryIndex文件,那么将会显示文件和文件夹列表。
常见的示例DirectoryIndex文件是index.html,index.htm,index.php和welcome.html。
当然,一个简单方便的方法就是手动创建一个DirectoryIndex文件,但是出于安全原因或其他原因,您最好是能够禁用目录浏览。
Apache可以禁用mod_autoindex,在Apache配置文件中设置适当的选项或使用htaccess文件来禁用的 自动目录索引。
如果您在平台上托管cPanel,也可以使用特定于平台的方法来禁用Apache的目录列表。
如何在cPanel中禁用Apache目录列表
禁用Apache中目录列表的方法:
禁用mod_autoindex
配置目录的选项指令
配置.htaccess
通过禁用自动索引模块来禁用Apache目录列表
最简单的方法可能是autoindex完全禁用该模块,禁用该模块将影响服务器上托管的所有站点。
启动您的首选终端应用程序
禁用的autoindex模块Apache。… Read More