My goal is to optimize my apache server. At first I want to disable some modules on it. I was surfing over the Internet and didn't find anything dedicated to apache which is installed on CentOS7. Here are what I have got from surfing: disable unneeded modules,enable apache modules from the command line and on. I can list Apache enabled modules using this httpd -t command. Also I know that modules that were compiled during the installation is lying in /etc/httpd/modules directory.

So what is the right way of disabling and enabling apache modules on CentOS7?

  • Commenting-out (or adding) modules in httpd.conf seems the normal way for Red Hat-based systems such as CentOS. Jan 31, 2016 at 14:46
  • There is nothing to comment out in httpd.conf file on CentOS7
    – fuser
    Jan 31, 2016 at 15:25

3 Answers 3


On CentOS 7, the right way to do it is to go through /etc/httpd/conf.modules.d and find the appropriate conf files with the modules you want to disable. You can also check /etc/httpd/conf/httpd.conf, but you'll have better luck in the conf.modules.d folder.

Simply comment them out, reload apache, and you're good to go.

  • 2
    I don't understand how I can comment something in conf.modules.d folder?And there is nothing to comment out in /etc/httpd/conf/httpd.conf file o_O
    – fuser
    Jan 31, 2016 at 15:28
  • 1
    Standard apache installations on CentOS 7, using yum, places a folder called /etc/httpd/conf.modules.d folder that has plenty of configuration files that load modules, including /etc/httpd/conf.modules.d/00-base.conf.
    – Sokel
    Jan 31, 2016 at 17:21
  • It is needed just to rename modules in /etc/httpd/conf.d/:) That's all! And after systemctl restart httpd this module won't work! Thanks a lot for forwarding in right way!
    – fuser
    Jan 31, 2016 at 18:33
  • A comment in this case could be a # character at the beginning of the line that says, "LoadModule ..." if you need an example.
    – Marty
    Aug 22, 2018 at 16:19

With /etc/httpd/conf.modules.d or /etc/httpd/conf.d, the principles are the same: to disable a module or a configuration file, rename its file extension to something different from .conf.

  • 4
    The problem with renaming the config file to disable a module is that if/when the yum package that created the config file gets updated it will put the original file back in place thus re-enabling the module(s).
    – Yeroc
    Jun 13, 2018 at 22:46

I created a small python script to help you with it. Please have a look at https://github.com/zioalex/unused_apache_modules

This is what you can expect from it:

curl http://localhost/server-info > http_modules_test.txt
cat http_modules_test.txt| python find_unused_apache_mod.py

Module name mod_python.c
Configuration Phase Participation: 4
Request Phase Participation: 11
Current Configuration: 3

Module name mod_version.c
Configuration Phase Participation: 0
Request Phase Participation: 0
Current Configuration: 1

Module name mod_proxy_connect.c
Configuration Phase Participation: 0
Request Phase Participation: 0
Current Configuration: 0

To remove safely:
POPPED:  mod_proxy_connect.c

To KEEP:  ['mod_python.c', 'mod_version.c', 'mod_proxy_connect.c']

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.