Howto Restart Apache Graceful

January 24th, 2009 Category: Apache

Sometimes when changing settings in your Apache config, adding virtual hosts and so on it’s needed to reload/restart the Apache daemon. Usually this is done with:

/etc/init.d/apache2 restart

But there two big disadvantages using this method:

  1. If your config is invalid, Apache will shutdown and not start again
  2. Users currently accessing your server will recognize that Apache will not answer request for a short time

Indeed there is a much more better method to restart the Apache “gracefully”:

apache2ctl -t
Syntax OK


apache2ctl -k graceful

The first command will tell Apache to check your config. If everything is correct, you will get “Syntax OK”, otherwise the error will be reported but Apache will still run with the old configuration.

The second command will tell Apache to restart gracefully with the advantage that currently open connections are not aborted and the users will not be annoyed.

Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Webnews
  • MisterWong
  • Y!GG
  • Facebook
  • Furl
  • Google Bookmarks
  • Live-MSN
  • Readster
  • YahooMyWeb

Related posts:

  1. Apache Tuning Part 2
  2. Apache Tuning Part 1
  3. Apache Tuning Part 3
  4. Happy Birthday Apache!
  5. Howto Beautify Ugly .PHP URL’s
This entry was posted on Saturday, January 24th, 2009 and is filed under Apache. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply