How to disable un-necessary default Apache Modules

By default Apache loads number of modules which probably you do not need. If you’re running mostly WordPress based websites on your VPS / Server, you can consider disabling un-needed Apache modules. this can save numerous memory and optimize server.

In this tutorial I will explain how to disable un-needed Apache modules on a CentOS / RedHat server / VPS.

Here is the list of minimum Apache modules which is required to run WordPress websites.

mod_alias
mod_authz_host
mod_deflate
mod_dir
mod_expires
mod_headers
mod_mime
mod_rewrite
mod_log_config
mod_autoindex
mod_negotiation
mod_setenvif

You can safely disable all other Apache modules on your server / VPS.

Before making any change in Apache configuration file, we will first make a backup of the Apache configuration file.
Login as root to your server via SSH and run below commands:

cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd-default.conf

This will make a copy of Apache configuration file and save as httpd-default.conf

Open Apache configuration file in nano text editor.

nano /etc/httpd/conf/httpd.conf

Put # mark in the beginning of module which you want to disable.
Save the file,Now restart Apache

service httpd restart

Done!