nginx: worker_proccesses directive doesn't work

Solution 1:

You said that your error message was:

nginx: [emerg] "worker_processes" directive is not allowed here in /etc/nginx/sites-enabled/default:1
nginx: configuration file /etc/nginx/nginx.conf test failed

Place this directive at the top of /etc/nginx/nginx.conf instead of in /etc/nginx/sites-enabled/default. The worker_processes directive is valid only at the top level of the configuration.

The same applies to all the other worker_* directives you've used.

Solution 2:

You have a syntax error in your configuration file:

worker_rlimit_
nofile 8192;

It appears that this line got split by accident. It should appear as:

worker_rlimit_nofile 8192;

The same error seems to have happened with the line beginning with worker_cpu_affinity.

Once you fix this, you should get your server back up and running.

Tags:

Nginx