Syntax error checking methods apache's httpd.conf

After modifying the apache httpd.conf file, how to verify that the syntax is correct?

Of course, we can restart the apache server, but this way, if in case there is an error, apache server will not start, can not provide normal service.

So after we modified the apache configuration file, verify its best to ensure that after the syntax is correct, only to restart the apache server. 
 
apache httpd.conf syntax validation can be verified by the following command. 
Windows environment: 
httpd -t 
或者: 
httpd.exe -w -t -f "C:\Apache2.2\conf\httpd.conf" -d "C:\Apache2.2\." 

 

Linux environment: 

apachectl configtest 
或 
apache2ctl configtest 
apache2 SuSE and other systems, possibly apache2ctl command. 

If you are unsure own apache servers in the end which command to use, you can use 

find / -name "apachectl" 
或者 
find / -name "apache2ctl" 

To find it. 

If the correct information is displayed Syntax OK. 

sudo /Applications/MAMP/Library/bin/apachectl  configtest
Syntax OK

If there is an error, the error line number and an error message will be displayed, as follows: 

sudo /Applications/MAMP/Library/bin/apachectl  configtest
Syntax error on line 623 of /Applications/MAMP/conf/apache/httpd.conf:
CustomLog takes two or three arguments, a file name, a custom log format string or format name, and an optional "env=" clause (see docs)

 

 

Guess you like

Origin www.cnblogs.com/mzhaox/p/11230900.html