BASH script to remove superfluous Apache/httpd modules
httpd
comes with a lot of modules enabled by default. Run this simple BASH
script to remove them all, re-instate those required for a default install (configtest
will reveal the errors without loading the broken config) and salt to taste:
CONFIG=/etc/httpd/conf/httpd.conf sed 's/^LoadModule/#LoadModule/g' -ie $CONFIG ALLOWED_MODULES="mime_module dir_module log_config_module authz_host_module alias_module autoindex_module negotiation_module setenvif_module rewrite_module" for MODULE in $ALLOWED_MODULES; do sed "s/^#\(LoadModule $MODULE.*\)/\1/g" $CONFIG | grep $MODULE sed "s/^#\(LoadModule $MODULE.*\)/\1/g" -i $CONFIG done /etc/init.d/httpd configtest && /etc/init.d/httpd graceful