Skip to main content

How to persistently set Nginx's worker processes?

Comments

7 comments

  • cPRex Jurassic Moderator
    Hey there! Have you tried using the details under the Global Configuration in this section? NGINX with Reverse Proxy | cPanel & WHM Documentation This will let you create configuration files that area read globally for all accounts.
    0
  • gotdoge
    Hey there! Have you tried using the details under the Global Configuration in this section? Core functionality Tried adding a code block here to show the top 15 lines of /etc/nginx/nginx.conf, but getting a 403 upon submitting a post reply with it. I noticed that worker_connections seems to be preserved when set to a custom setting, but worker_processes is still reverted back to 1. I had changed worker_processes to auto again and worker_connections's 1024 to 4096, but only the former was reverted. Being able to adjust this directive is a pretty integral part of configuring Nginx so I believe cPanel should look at incorporating some form of managing more of the configuration natively.
    0
  • cPRex Jurassic Moderator
    I'm not finding much on my end for this. Could you create a ticket with our team so we can do a bit more research on this for you?
    0
  • Thimempapa
    I have the same problem. How to set Worker Processes ?? I just can have 1, like for one CPU Core. Manual says one Worker per CPU core but the setting in /etc/nginx.conf keeps reverting.
    0
  • cPRex Jurassic Moderator
    @Thimempapa - there's no way to make that change at this time. Could you submit a feature request for that using the link in my signature?
    0
  • Thimempapa
    There"s a solution now. after contacting support, this here work for me: # cp -vi /etc/nginx/nginx.conf{,.bkp} # cat /etc/nginx/ea-nginx/settings.json { "apache_port" : "81", "apache_port_ip" : "127.0.0.1", "apache_ssl_port" : "444", "apache_ssl_port_ip" : "127.0.0.1", "client_max_body_size" : "128m", "worker_processes" : "2" } After "worker_processes" : "2" has been appended to /etc/nginx/ea-nginx/settings.json as outlined above, you would also need to rebuild the configuration: /scripts/ea-nginx config --all Then you can verify the worker_processes is retained in the NGINX configuration with the following commands: # cat /etc/nginx/ea-nginx/settings.json { "apache_port" : "81", "apache_port_ip" : "127.0.0.1", "apache_ssl_port" : "444", "apache_ssl_port_ip" : "127.0.0.1", "client_max_body_size" : "128m", "worker_processes" : "2" } # grep worker /etc/nginx/nginx.conf worker_processes 2; worker_shutdown_timeout 10s; worker_rlimit_nofile 65536; worker_connections 4096; # Modify settings.json did not work because the reconfig must be run afterwards. so the solution to edit settings.json is working very well ;)
    0
  • cPRex Jurassic Moderator
    Thanks for sharing!!!
    0

Please sign in to leave a comment.