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
- independant of
httpd.conf
- 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?
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 theLoadModule
line and comment out the correspondingInclude
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.Well, it should be. And in later versions of Apache it does appear to be.
I wouldn't remove the
autoindex.conf
file. I would just comment out the line that includes it in the main server config.