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
Under normal circumstances, executing /usr/local/openresty/nginx/sbin/nginx -t will have two successes, but mine is a success and a failure.
We can enable a server block's configuration file by creating a symbolic link from the sites-available directory to the sites-enabled directory, which Nginx will read during startup. To do this, enter the following command: sudo ln -s /etc/nginx/sites-available/ example.com /etc/nginx/sites-enabled/
The way nginx and its modules work is determined in the configuration file. By default, the configuration file is named nginx. conf and placed in the directory /usr/local/nginx/conf , /etc/nginx , or /usr/local/etc/nginx .
To start your OpenResty®, you can just use the openresty command in place of your original nginx command as long as you have correctly added the <openresty-prefix>/bin/ directory to your system environment PATH ( <openresty-prefix> is default to /usr/local/openresty/ unless being overridden by ./configure 's --prefix= ...
Through a simple command you can verify the status of the Nginx configuration file: $ sudo systemctl config nginx The output will show if the configuration file is correct or, if it is not, it will show the file and the line where the problem is.
Just add events { }
above the http {
line:
events {} http { server { # Your code here } }
Put above http{}
events { worker_connections 1024; }
Nginx worker_connections : sets the maximum number of simultaneous connections that can be opened by a worker process.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With