How to Apply Apache Configuration Changes Gracefully

From time to time, you may need to make changes to your Apache HTTP Server configuration file, especially if you are optimizing your web server for performance. Once you have completed changes, they will not come into effect until you restart your web server. This, however, would mean downtime, however briefly, for anyone visiting your websites. One way to minimize the downtime is to perform a graceful restart.

Unlike an immediate reload that ends all processes and restarts the web server, a graceful restart will instruct the parent process to advise the child processes to exit only after their current requests have ended. The parent process then applies the new configuration to each new child that appears after the old ones have died.

To execute a graceful restart, run:

# apachectl -k graceful


# apache2ctl -k graceful

On Red Hat Enterprise Linux, CentOS, and other varieties, the following will also work:

# /etc/init.d/httpd graceful


# service httpd graceful

On Debian, Ubuntu, and other varieties, you can run:

# /etc/init.d/apache2 reload

Although it says “reload”, it is actually the equivalent of a graceful restart.

For more information about graceful restarts, see the online Apache documentation.