Programming + Design

Modifying the httpd.conf file on a WHM/CPanel server PDF Print E-mail
Written by Brett Brewer   
Sunday, 06 April 2008

For those that do not know, the httpd.conf file is that special file on your Apache web server that controls all the fun stuff. It's where you enable modules, set default behaviors for web directories and create your "vhosts" which are the configuration containers that turn your specific web sites on and off. Depending on how your server is set up, you may need to take special things into consideration simply to make edits to this file because some types of servers build this file automagically and will destroy some types of changes. This is apparently true on WHM/CPanel servers. There are certain things you can and can't modify by hand in your Apache httpd.conf file on a WHM/Cpanel based server. The following info applies to Apache 1.3.41 and may not work for Apache2. Some options, such as enabling gzip output compression should be done from the WHM/CPanel apache updater, which will make the necessarry configuration file changes for you after you have recompiled apache with new modules or new PHP options. Sometimes you may need to manually modify the httpd.conf file to customize some things, but if you don't run a few extra commands after you are done, your config changes will be lost the next time apache is recompiled.

To avoid this, you can either put your config changes in the applicable configuration include files located in:


or if you directly edit the httpd.conf file you can run the following commands in hopes of keeping your configuration changes the next time Apache is compiled....

First run the configuration distiller...

/usr/local/cpanel/bin/apache_conf_distiller --update

Then rebuild your httpd.conf file....


Now reopen the httpd.conf file and see if your changes are still there. If not, you probably edited a section you are not allowed to manually edit. In this case, try to put your directives in one of the include files.  

Now to test your new config prior to restarting your live Apache server (so you don't risk crashing your live server)....

/usr/local/apache/bin/apachectl configtest

Assuming there's no major errors you can now restart apache...

service httpd restart 

That's all folks!

Last Updated ( Tuesday, 08 April 2008 )
< Prev   Next >


Who's Online

© 2017
Joomla! is Free Software released under the GNU/GPL License.