大网数据广告活动
服务器运维问答

Disabling mod_autoindex dies on autoindex.conf being replaced

· 52CE 我爱测

I was hardening my webserver - CentOS 7.5.1804, httpd 2.4.6_80 - and followed the myriad of examples that suggested disabling mod_autoindex. (see Commenting out LoadModule autoindex_module modules/mod_autoindex.so ) httpd doesn't…

问题原文

原帖链接 · datakid · CC BY-SA 4.0

I was hardening my webserver - CentOS 7.5.1804, httpd 2.4.6_80 - and followed the myriad of examples that suggested disabling mod_autoindex. (see Commenting out LoadModule autoindex_module modules/mod_autoindex.so)

httpd doesn't restart because /etc/httpd/conf.d/autoindex.conf has entries that httpd no longer understands. Fine, removed autoindex.conf.

Then I updated the server, and found that autoindex.conf had been replaced in the update, again preventing the httpd from starting.

Does anyone know why autoindex.conf is

  1. independant of httpd.conf
  2. not wrapped in <IfModule mod_autoindex></IfModule> markers?

Subsequently, does anyone know how to turn mod_autoindex off and keep it off without threatening to prevent httpd from starting?

已采纳解答

原帖链接 · MrWhite · CC BY-SA 4.0

why autoindex.conf is independant of httpd.conf

Well, it only contains directives related to mod_autoindex (the Fancy directory listing feature) so it makes sense to have these in a separate conf file. This conf file is included in the main server httpd.conf file. So, to disable mod_autoindex you should comment out the LoadModule line and comment out the corresponding Include directive.

If these directives weren't independent of httpd.conf then you would have considerably more editing to do in order to remove this module.

why autoindex.conf is not wrapped in <IfModule mod_autoindex></IfModule> markers?

Well, it should be. And in later versions of Apache it does appear to be.

how to turn mod_autoindex off and keep it off

I wouldn't remove the autoindex.conf file. I would just comment out the line that includes it in the main server config.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-08-09)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。