Nginx instructions are not allowed in the sample nginx.conf of Unicorn

I am using nginx 1.4.1. After copying unicorn’s example of nginx.conf, I found that I must move the settings to a different instruction. I still can’t The following settings are placed in the nginx.conf file: worker_processes, user, pid and events block. When I place them as they are, the log shows command is not allowed here. What should I do?

worker_processes 1;
user deployer sudo; # for systems with a "nogroup"
pid /run/nginx.pid;

events {
worker_connections 1024; # increase if you have lots of clients
accept_mutex off; # "on" if nginx worker_processes> 1
}

upstream qwuen {
...
}

server {
...
}

Update 1

I know this post, but no matter what I do, it’s useless. It’s weird. I can’t find any documentation in nginx.

The original example cannot be used directly, because the main configuration is located in /etc/nginx/nginx.conf. /etc/nginx/nginx.conf has http commands, including sites-enabled / *Directives. The only changes made on /etc/nginx/nginx.conf are:

work_processes 4;
worker_connections 1024;

In addition, delete text/html from it, because it has been compressed by gzip by default.

The final result of your nginx.conf in your application should have no http directives, only upstream and Server.

I am using nginx 1.4.1. After copying unicorn’s example of nginx.conf, I found that I must move the settings to a different Directives. I still can’t put the following settings in the nginx.conf file: worker_processes, user, pid and events block. When I place them as they are, the log shows directive is not allowed here. I What should I do?

worker_processes 1;
user deployer sudo; # for systems with a "nogroup"
pid /run/nginx.pid;

events {
worker_connections 1024; # increase if you have lots of clients
accept_mutex off; # "on" if nginx worker_processes> 1
}

upstream qwuen {
...
}

server {
...
}

Update 1

I know this post, but no matter what I do, it doesn’t work. It’s weird. I can’t find any documentation in nginx.

The original example cannot be used directly because the main configuration is located in /etc/nginx/nginx.conf. /etc/nginx/nginx.conf has http directives, including sites-enabled/* directives. In /etc/nginx/nginx.conf The only changes made on the above are:

work_processes 4;
worker_connections 1024;

Also, delete text/html from it because It has been compressed by gzip by default.

The final result of your nginx.conf in your application should have no http instructions, only upstream and server.

Leave a Comment

Your email address will not be published.