Apache检查httpd.conf的语法错误的方法
修改了apache httpd.conf文件之后,怎么样验证其语法是否正确呢?
当然,我们可以重新启动apache服务器,但这样一来,如果万一存在错误,apache服务器将不能正常启动,也不能提供正常服务。
所以我们在修改了apache的配置文件之后,最好对其验证,确保了其语法上正确无误之后,才重新启动apache服务器。
apache httpd.conf语法验证可以通过下面的命令来验证。
Windows环境:
httpd -t
或者:
httpd.exe -w -t -f "C:\Apache2.2\conf\httpd.conf" -d "C:\Apache2.2\."
Linux环境:
apachectl configtest
或
apache2ctl configtest
SUSE等系统的apache2,可能为apache2ctl命令。
如果你不能确认自己的apache服务器到底使用哪个命令,你可以使用
find / -name "apachectl"
或者
find / -name "apache2ctl"
来查找一下。
如果正确无误,会显示Syntax OK信息。
sudo /Applications/MAMP/Library/bin/apachectl configtest
Syntax OK
如果存在错误,则会显示出错的行号以及错误信息,如下:
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)
- Apache配置文件(httpd.conf)的语法检查
- 黄聪:DEDEAMPZ整合apache配置httpd.conf文件(You don't have permission to access / on this server. )解决方法
- 在PHP中检查PHP文件是否有语法错误的方法
- apache httpd服务 错误排除方法
- Apache启动错误Permission denied: httpd: could not open error log file解决方法
- apache重启和语法检查过程中的几个小错误解决
- apache重启错误: httpd: Syntax error on line 57 of /etc/httpd/httpd.conf: Cannot load /usr/local/apache2/
- httpd: Syntax error on line 53 of /usr/local/apache/conf/httpd.conf的解决方法
- Apache http服务器整合php出现httpd.exe应用程序错误的解决方法
- [httpd.conf]Apache发布的网站限制某些网段的访问方法
- apache检测httpd.conf 配置文件错误行语句
- 关于windows下apache运行php出现httpd.exe错误的解决方法
- linux下的apache在httpd.conf配置目录别名和include引入自配置文件配置的方法
- 在PHP中检查PHP文件是否有语法错误的方法
- Apache httpd.conf 配置文件语法验证
- apache检测httpd.conf 配置文件错误行语句
- apache配置文件语法错误命令:httpd -t
- Apache httpd.conf 配置文件语法验证
- Apache httpd.conf 配置文件语法验证
- apache重启出现 httpd: Could not reliably determine the server's fully qualified domain name错误解决方法