Test apache without modifying original httpd.conf

What will you do if you want to try some new directives within the apache?

Typically you’ll modify the original httpd.conf to try out different Apache directives. If something doesn’t work out, you have to revert back the changes. In this case chances of corrupting the original file are good. 

So the HACK is, instead of playing around with the original httpd.conf, copy it to a new httpd.conf.debug and use this new file with Apache for testing purpose as shown.

STEP #1. Stop the apache, if its running.
service httpd stop

STEP #2. Points the apache to new debug file
apachectl -f /etc/httpd/conf/httpd.conf.debug

STEP #3. Now start the apache with this new file
httpd -k start -f /etc/httpd/conf/httpd.conf.debug

STEP #4. Check, if apache is using the new debug file
ps -ef | grep http

When you are done and satisfied with all your directives

STEP #5. Stop the apache and copy the debug file to original file.
cp httpd.conf.debug httpd.conf

STEP #6. Start the apache again.
apachectl start

STEP #7. Confirm again using ps
ps -ef | grep http

So you had just learned the HACK of testing a httpd.conf file without modifying your existing file.

Here is the detailed snapshot from my machine.

(PS: if you are not satisfied with your new directives don’t do STEP #5.)


Test apache without modifying original httpd.conf