How do you restart Apache?

sudo service apache2 restart for the way that's borrowed from Red Hat.


Do you want to restart Apache, or do you want to gracefully reload its configuration?

Everyone was answering the first question; you can do the second with

sudo service apache2 reload

Gracefully reloading is a bit faster, and there's no downtime.

There's one caveat: if your apache config files contain an error (e.g. configures a log file in a directory that doesn't exist), the server may silently exit without printing any error messages to the console. Most other errors are caught by the apache2ctl configtest that service apache2 reload runs before doing the actual reload with apache2ctl graceful.


The recommended way under Ubuntu to start/stop services (not just Apache) is to use the start/stop/reload commands (which really are symbolic links to the initctl program, part of upstart).

For services that use the legacy /etc/init.d scripts, the corresponding script will be called with the correct parameters; for services that use the upstart infrastructure, the appropriate event transition will be signaled to the upstart daemon via initctl.

So, to start/stop/reload/restart apache on Ubuntu, you can use:

sudo start apache2
sudo stop apache2
sudo reload apache2
sudo restart apache2