Re-read httpd.conf without downtime

Posted on

QUESTION :

Is there a way to get Apache to re-read the httpd.conf without downtime?

I am running a web service that a number of users need to stay connected to, however I have recently made some changes to httpd.conf which will not be re-read by Apache unless it is restarted. Each restart inevitably causes issues for some users resulting in a series of technical support calls however, according to LPI Linux Certification in a nutshell:

The httpd daemon will respond to the HUP signal by rereading its configuration files. If you’ve made changes and want httpd to reconfigure itself, send it the HUP signal:
$ kill -HUP 'cat /var/run/httpd.pid'

I looked into the in-built taskkill and Stop-Process commands but it doesn’t allow for different signals. My guess is that SIGHUP isn’t supported by Windows but haven’t found any hard evidence against this. Perhaps there is a much simpler solution I have missed.

ANSWER :

Should be possible using the command:

sudo /etc/init.d/apache2 reload

or

sudo service apache2 reload

More info on: http://www.electrictoolbox.com/article/apache/restart-apache/

On Windows, you can try:

httpd -k restart

Although I believe doing a graceful restart isn’t supported on Windows. More info on: http://httpd.apache.org/docs/2.2/platform/windows.html#wincons

Leave a Reply

Your email address will not be published.