When you make changes to the Apache configuration files it is always a good idea to check the configuration for errors before reloading/restarting Apache. Otherwise Apache will throw an error message and refuse to start and your site(s) will be offline. To check the active configuration files for errors you can use the following command:

apache2ctl -t

If everything is fine the server will respond with Syntax OK. Otherwise you will get an error message with details on the first error Apache finds, e.g. ‘Syntax error on line 218 of /etc/apache2/apache2.conf‘. Repeat the command till all errors are fixed and it returns Syntax OK.

If you made changes to a copy of the configuration file or created a new virtual host that is not yet enabled you can test this file by specifying the full path with

apache2ctl -t -f /etc/apache2/sites-available/newvhost