【发布时间】:2019-06-26 03:27:45
【问题描述】:
在X-WAF部署中,需要新建一个nginx配置文件。但是在测试nginx配置的时候,发现报错,无法启动nginx。
我参考http://blog.51cto.com/14071176/2318054,我按照文章中的配置一步步做了,但是遇到了问题。
root@VM-0-6-ubuntu:~# /usr/local/openresty/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/openresty/nginx/conf/nginx.conf syntax is ok
nginx: [emerg] no "events" section in configuration
nginx: configuration file /usr/local/openresty/nginx/conf/nginx.conf test failed
root@VM-0-6-ubuntu:~# /usr/local/openresty/nginx/sbin/nginx
nginx: [emerg] no "events" section in configuration
正常情况下,执行/usr/local/openresty/nginx/sbin/nginx -t 会成功两次,而我的是成功和失败。
【问题讨论】:
-
只需在
http {行上方添加events { }。 -
谢谢,我使用另一个网站的 nginx.conf 配置文件来解决这个问题。确实是nginx.conf的问题。我指的另一个站点是kongdewei.cn/2017/08/11/…
标签: nginx openresty web-application-firewall