Hack 76. Pass different httpd.conf filename to apachectl

Typically you’ll modify the original httpd.conf to try out different Apache directives. If something doesn’t work out, you’ll revert back the changes. Instead of playing around with the original httpd.conf, copy it to a new httpd.conf.debug and use this new httpd.conf.debug file with Apache for testing purpose as shown below using option -f.

# apachectl -f conf/httpd.conf.debug

# httpd -k start -f conf/httpd.conf.debug

[Note: you can use either apachectl or httpd as shown above]

# ps -ef | grep http
root   25080     1  0 23:26 00:00:00 /usr/sbin/httpd -f conf/httpd.conf.debug
apache 25099 25080  0 23:28 00:00:00 /usr/sbin/httpd -f conf/httpd.conf.debug

[Note: ps shows the httpd running with httpd.conf.debug file]

Once you are satisfied with the changes and Apache runs without any problem with httpd.conf.debug, you can copy the changes to httpd.conf and start the Apache normally as shown below.

# cp httpd.conf.debug httpd.conf

# apachectl stop

# apachectl start

# ps -ef | grep httpd
root     25114     1  0 23:28 00:00:00 /usr/sbin/httpd -k start
daemon   25115 25114  0 23:28 00:00:00 /usr/sbin/httpd -k start

[Note: ps indicates that the httpd is running using the default config file]

Comments on this entry are closed.