nginx: worker_proccesses directive doesn't work

user133529 asked:

I wanted to try to set the worker processes in nginx, but it throws me this error:

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

here is my code

worker_processes 4;
worker_rlimit_nofile 8192;
worker_priority 0;
0001 0010 0100 1000;

server {
    server_name --.--.--.---;
    listen 80;

    #root /var/www/devsites/wordpress/;
    root /var/www/devsites/trademob/tm-hp-v2/;

What can I do to fix this issue?

My answer:

You have a syntax error in your configuration file:

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.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.