I'm using nginx 1.4.1. After copying unicorn's example of nginx.conf
, I found out the settings must be moved to different directives. I still couldn't manage to place the following settings in the nginx.conf
file: worker_processes
, user
, pid
and events
block. When I place them as it is now, the log shows directive is not allowed here
. What should I fix?
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 abc {
...
}
server {
...
}
I know about this post, but it's weird that whatever I am doing is not working. I couldn't find any docs in nginx.
The original example cannot be used directly, because the main configuration is at /etc/nginx/nginx.conf
. /etc/nginx/nginx.conf
has http
directives, which includes the sites-enabled/*
directives. The only changes to be made on /etc/nginx/nginx.conf
are:
work_processes 4;
worker_connections 1024;
Also, remove text/html
from it because it's already gzipped by default.
The end result of your nginx.conf
in your app should have no http
directives, just upstream
and server
.
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