Rootop 服务器运维与web架构

nginx -t 语法检查通过单测试配置文件失败

群里求助nginx无法启动,提示下面错误:

nginx: the configuration file /www/server/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /www/server/nginx/conf/nginx.conf test failed

按照以前来经验来看,会紧接着提示错误具体位置,但是这里没提示。
检查 nginx.conf 中配置

error_log  /www/wwwlogs/nginx_error.log crit;

把错误级别从 crit 改为 debug

error_log  /www/wwwlogs/nginx_error.log debug;

再执行 nginx -t后错误位置出现了,只要有错误日志了,就好排查问题了。

分析可能是nginx include的虚拟主机配置文件,有个lua脚本的配置,但是代码里缺少了一个resty.redis模块。
导致nginx -t检测失败,当前的错误级别也没打印出lua的错误信息。

原创文章,转载请注明。本文链接地址: https://www.rootop.org/pages/4674.html

作者:Venus

服务器运维与性能优化

评论已关闭。