United States (change)
Shortcuts: Downloads Fedora Red Hat Network
Account Links: Cart Your Account Logout
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 configurationThe 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.