Nginx startup prompt [emerg] no "events" section in configuration Ask Question

Nginx startup prompt [emerg] no

In the X-WAF deployment, you need to create a new nginx configuration file. However, when testing the nginx configuration, an error is found and nginx cannot be started.

I refer to http://blog.51cto.com/14071176/2318054,I did it step by step according to the configuration in the article, but I had a problem.

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 を実行すると 2 つの成功が発生しますが、私の場合は成功と失敗が 1 つずつ発生しました。

ベストアンサー1

events { }上の行に追加するだけですhttp {:

events {}
http {
    server {
        # Your code here
    }
}

おすすめ記事