Columbus, Ohio

Test configuration before restarting Apache

Have you ever made a lot of changes to your apache conf files on your web server that you were worried that the changes may result in apache not restarting? I know I have. There is a way to check your changes before you restart the running service.


httpd -t
# or
/usr/sbin/httpd -t

If everything was entered correctly, you should see the following message printed: “Syntax OK”.

If there are errors, it will print the first one it finds and exits. Otherwise it will print all the warnings if any and then print the “Syntax OK” message.

If you keep each virtual host in a separate configuration files like I do, then you can check the specific httpd.conf file.


httpd -t -f /path/to/virtual/httpd.conf

Join My FREE Newsletter

Get the latest news and episodes of the Cloud Entrepreneur Podcast and Angelo’s development blog directly in your inbox!