CentOS: Apache Optimization

Modules

You can remove certain Apache modules from loading simply by editing httpd.conf and commenting out the unwanted modules starting with the LoadModule directive, and then restarting Apache.

Some common modules to disable that are rarely used, include:

  • mod_autn_anon
  • mod_authn_dbm
  • mod_authz_owner
  • mod_authz_groupfile
  • mod_authz_dbm
  • mod_ldap
  • mod_authnz_ldap
  • mod_usertrack
  • mod_dav
  • mod_dav_fs
  • mod_actions (CGI support)
  • mod_speling
  • mod_proxy
  • mod_proxy_balancer
  • mod_proxy_ftp
  • mod_proxy_http
  • mod_proxy_connect
  • mod_cgi (CGI support)

Features

CentOS ships with a lot of features enabled by default that are probably not necessary.

Documentation Manual

Apache will show the server documentation by default at the /manual URL of the server. You can remove this simply by deleting the manual.conf file and restarting apache.

rm -fv /etc/httpd/conf.d/manual.conf
/etc/init.d/httpd restart
AJP Proxy

Proxy module for AJP backend servers (such as Tomcat). The module is loaded by default.

rm -fv /etc/httpd/conf.d/proxy_ajp.conf
/etc/init.d/httpd restart
Perl

Mod_perl incorporates a Perl interpreter into the Apache web server, so that the Apache web server can directly execute Perl code.

rm -fv /etc/httpd/conf.d/perl.conf
/etc/init.d/httpd restart
Python

Mod_python is a module that embeds the Python language interpreter within the server, allowing Apache handlers to be written in Python.

rm -fv /etc/httpd/conf.d/python.conf
/etc/init.d/httpd restart
Squid

Squid is installed by default, and you can remove the package from CentOS directly, or just remove the configuration file.

yum -y remove squid
/etc/init.d/httpd restart

Uninstalling squid will remove the squid.conf as well. Or you can do it manually. Either way, be sure to restart the web server.

rm -fv /etc/httpd/conf.d/squid.conf
/etc/init.d/httpd restart
Webalizer

Webalizer is also installed by default, and you can remove the package from CentOS directly, or just remove the configuration file.

yum -y remove webalizer
/etc/init.d/httpd restart

Uninstalling squid will remove the webalizer.conf as well. Or you can do it manually. Either way, be sure to restart the web server.

rm -fv /etc/httpd/conf.d/webalizer.conf
/etc/init.d/httpd restart