How to restart Apache server on Linux (Ubuntu)

If you edit or update an Apache configuration file, you need to restart it for the changes to take effect. Use this command on Ubuntu:

# sudo apache2ctl graceful

On some distributions this may be slightly different, so if you get a command not found error, try this:

# sudo apachectl graceful

One good feature of this is that it checks the configuration files before attempting to restart and so should avoid bringing down the server completely if there is an issue or typo in your edit.

Tags: