How to test restart apache

If you’re new to Linux, and to Apache, chances are you are going to make a couple of mistakes when updating configuration files.

Fortunately there are a few commands to help you fix these issues before you make the changes matter.

With most changes to the Apache configuration file, you are required to restart Apache for the changes to take affect, but if you’ve made a mistake in your reconfiguration then Apache will still restart with those mistakes present, or what’s worse it won’t restart at all and you’ll be without a website.

That’s when a nice little command like

sudo /usr/sbin/apache2ctl configtest

or,

sudo /usr/sbin/apachectl graceful

come in very handy. These commands return any error messages that you might receive if you were to reboot.

Once you’re happy the changes you have made are right to go, use the trusty

sudo /etc/init.d/apache2 restart

Leave a comment

Your email address will not be published. Required fields are marked *