Test the Apache Configuration File httpd.conf

After making changes to the Apache configuration file, testing the configuration before implementing it is a good practice.


To test the Apache configuration file for errors, use the following command:

apachectl configtest

If the configuration file is fine, this command will return Syntax Ok. Otherwise, it will return detailed information about the error discovered.

If apachectl is not in your PATH and you do not know where it is, refer to the tech recipe Find a file by name to find the location of apachectl, then run it with the fully qualified path. Note the following example:

/usr/local/apache/bin/apachectl configtest

 

About Quinn McHenry

Quinn was one of the original co-founders of Tech-Recipes. He is currently crafting iOS applications as a senior developer at Small Planet Digital in Brooklyn, New York.
View more articles by Quinn McHenry

The Conversation

Follow the reactions below and share your own thoughts.

2 Responses to “Test the Apache Configuration File httpd.conf”

  1. March 18, 2009 at 2:40 pm, Sjur Sørskår said:

    For win users this output is given by httpd.exe from console window

    Reply

  2. September 12, 2009 at 5:41 pm, Omer said:

    apachectl -t -f /path/to/the/conf/file/youwant/tested/httpd.conf

    Reply

Leave a Reply