1

Is restarting apache (which takes 2 seconds on my Ubuntu server) possible without having to put offline all my websites ?

In other terms, can I just restart apache and almost hide it to my customers (the worst can happen is to not being able to load a website page in that moment).

And if I have e-commerce shops ? Then it is an issue... ?

thanks

1 Answer 1

6

Use apache2ctl -k graceful if you really need a complete restart. It performs a more relaxed restart, allowing child processes to finish (like, it lets a download complete) and restarting after that.

Most of the time apache2ctl -k reload (or /etc/init.d/apache2 reload) is enough; it just re-reads the configuration file without doing a full restart.

2
  • 1
    This will increase the interval of non-availability for the server (you might have one person downloading a 20Gb file - apache won't restart until that's finished and won't accept new requests in the meantime). Solution is to have more than webserver (preferably on different boxes)
    – symcbean
    Sep 21, 2010 at 12:10
  • 1
    Actually during graceful restart Apache will continue running as usual. Parent will re-read its configuration files and reopen logs, idle children will restart immediately with the new settings and active children will continue the serve their current request and restart after that. The worst that can happen is that you have couple of old generation children still serving out some long-running http-request, such as downloading a huge file, but even those will restart as soon as their activity is finished. Sep 21, 2010 at 12:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .