Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 5 down vote accepted

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.

share|improve this answer
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 '10 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. –  Janne Pikkarainen Sep 21 '10 at 12:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.