Restart Apache2 Ubuntu

We need to restart our Apache2 web server when we want to load new configurations from the configuration files. Restarting the web server to load configuration files is necessary as these configuration files are only read each time when the web server is in the process starting.

Note that the Apache web server does not need to be restarted on every configuration change; sometimes a simple reload will do. In any case, restarting won't hurt.

How to Restart Apache2 on Ubuntu?

To restart Apache2 on Ubuntu, we enter the following command in a terminal such as bash:

/etc/init.d/apache2 restart

Of course, you most likely will need to be the superuser to do that so you might need to enter the following command and then your password when requested:

sudo /etc/init.d/apache2 restart

Restarting Apache2 fails - What to do next...

If the web server fails to restart you will be notified when you run the above command. The best thing to do is undo any changes you made to your Apache configuration to see which is causing the error.

Alternatively, you may check your error.log file to see what sort of error happened. Locate that file, which is in /var/log/apache2/error.log (by default on Ubuntu 10.04) and view it to see what Apache has to say about the error preventing it from starting.

We hope this tutorial on restarting Apache2 on Ubuntu Linux has been helpful.

Thank Tutorial Arena for This Tutorial.
Show your appreciation with a +1...