Account Links: Cart | Your Account | Logout

Skip to content

Red Hat Knowledgebase

Red Hat Knowledgebase Search:

Updated Within the Last:

New Solutions within the last day New Solutions within the last week New Solutions within the last month

Browse by topics:


Click to View a Topic
Red Hat Enterprise Linux > Web Server > Issue <<  58 of 73 >>

Solution Tools:


Email a Solution Postcard Printer version Submit a comment on this answer Update notifications Request an answer Back

Article Reference

Article ID: 9305
Last update: 10-17-06
Issue:
How can I perform syntax verification on the Apache configuration files?
Resolution:

A good way to perform a syntax check on apache is to execute the command:

#httpd -t

This command runs syntax tests on the /etc/httpd/conf/httpd.conf configuration file. It imeediately exits after these tests with either a return code of 0 (Syntax OK) or a return code not equal to 0.

Below is a sample session with correct syntax:

# httpd -t
Syntax OK

Here is another sample session with a syntax error:

# httpd -t
Syntax error on line 44 of /etc/httpd/conf/httpd.conf:
Invalid command 'ServerToken', perhaps misspelled or defined by a module not included in the server configuration
The error detected means that ServerToken is an unknown directive. The actual directive is ServerTokens.

It is a good practice to perform syntax checks before starting/restarting Apache after making any changes to the configuration files. This is especially true if the web service is critical. If there is a syntax error in any of the Apache configuration files, it will fail to come up during a restart, resulting in service downtime.


How well did this entry answer your question?


good wrong incomplete out of date
Red Hat Enterprise Linux > Web Server > Issue <<   58  of  73  >>