nginx-proxy-manager icon indicating copy to clipboard operation
nginx-proxy-manager copied to clipboard

Add ability to configure "worker_processes"

Open PingTrip opened this issue 3 years ago • 13 comments

Is your feature request related to a problem? Please describe. For a home network/low traffic deployment the current setting of worker_processes auto; is overkill since it spawns an nginx process for every core.

Describe the solution you'd like Provide a mechanism to override the current hard-coded "auto" setting.

Describe alternatives you've considered I tried overriding the parameter via /data/nginx/custom/root.conf which resulted in an Nginx error: nginx: [emerg] "worker_processes" directive is duplicate in /data/nginx/custom/root.conf:1.

PingTrip avatar Nov 09 '22 17:11 PingTrip

Exact same issue here. An environment variable like WORKER_PROCESSES would suffice. But while we're at it can we please add environment variables for thread pools as well, thanks!

k4my4b avatar Nov 10 '22 10:11 k4my4b

Bump up!

Using this in production of a small growing app. There's no direct way to override worker_connections. 1024 is surely not enough.

fevernova90 avatar Nov 12 '22 14:11 fevernova90

Having this issue as well, would love to see this implemented!

CreeperFace00 avatar Nov 16 '22 16:11 CreeperFace00

same here please help us to change worker_connections

msycn avatar Nov 13 '23 01:11 msycn

@msycn That is already possible thanks to the commit @Blooym made. Just put that line in /data/nginx/custom/events.conf and it will work just fine.

kroese avatar Nov 13 '23 01:11 kroese

@msycn That is already possible thanks to the commit @Blooym made. Just put that line in and it will work just fine./data/nginx/custom/events.conf

Wow ,you are my hero ! Thanks for your quick reply!!!

msycn avatar Nov 13 '23 01:11 msycn

@kroese getting the same issue, as reported here:

https://github.com/NginxProxyManager/nginx-proxy-manager/issues/3345

Any idea what is that line for? /data/nginx/custom/events.conf

Do we add it as env in the docker compose? or is it something else?

redtripleAAA avatar Feb 29 '24 06:02 redtripleAAA

@ansred It is a file that you can edit. So if you create that file, and put worker_processes 1; inside it it will work.

kroese avatar Feb 29 '24 11:02 kroese

@kroese Here is my docker compose

version: "3"

services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    container_name: Nginx_Proxy_Manager_SQLite
    restart: always
    ports:
      - '80:80'        # Public HTTP Port:
      - '443:443'      # Public HTTPS Port:
      - '81:81'        # Admin Web Port:
    environment:
        DB_SQLITE_FILE: "/data/database.sqlite"
        DISABLE_IPV6: 'true'

    volumes:
      - /volume1/docker/containers/npm/config/data:/data
      - /volume1/docker/containers/npm/config/cert:/etc/letsencrypt

I assume, in /docker/containers/npm/config/data/nginx just create the directory /custom and file /events.conf

Like this:

root@ds1520:/volume1/docker/containers/npm/config/data/nginx/custom# pwd
/volume1/docker/containers/npm/config/data/nginx/custom
root@ds1520:/volume1/docker/containers/npm/config/data/nginx/custom# cat events.conf
worker_processes 1;

And no other mapping required and things should work?

redtripleAAA avatar Mar 01 '24 20:03 redtripleAAA

that former work around doesnt seem to work any longer. Any other ideas?

❯ Starting nginx ...
nginx: [emerg] "worker_processes" directive is not allowed here in /data/nginx/custom/events.conf:1

TomErnst1972 avatar Sep 05 '24 17:09 TomErnst1972

Issue is now considered stale. If you want to keep it open, please comment :+1:

github-actions[bot] avatar Mar 22 '25 02:03 github-actions[bot]

Issue is now considered stale. If you want to keep it open, please comment 👍

please fix

msycn avatar Mar 22 '25 04:03 msycn

please fix or advise if there is another way to achieve this. Or to be considered as road map item?

TomErnst1972 avatar Mar 23 '25 13:03 TomErnst1972

@msycn That is already possible thanks to the commit @Blooym made. Just put that line in /data/nginx/custom/events.conf and it will work just fine.

Worked perfectly! I'm a bit new to Nginx, but aside from the conf existing in the container, how can we prove that the values have changed?

JosChavz avatar Sep 29 '25 18:09 JosChavz

@msycn That is already possible thanks to the commit @Blooym made. Just put that line in /data/nginx/custom/events.conf and it will work just fine.

Worked perfectly! I'm a bit new to Nginx, but aside from the conf existing in the container, how can we prove that the values have changed?

do the following on the host (and count the numbers of nginx) (assuming you have only one container running nginx)

[root@proxy ~]$ ps fax|grep "nginx: worker process"
4111100 pts/0    S+     0:00              \_ grep nginx: worker process
2973355 ?        S      0:05      |       \_ nginx: worker process
2973356 ?        S      0:04      |       \_ nginx: worker process
2973357 ?        S      0:05      |       \_ nginx: worker process
2973358 ?        S      0:04      |       \_ nginx: worker process

or

[root@proxy ~]$ ps fax|grep -v grep | grep "nginx: worker process" | wc -l
4

TomErnst1972 avatar Sep 30 '25 11:09 TomErnst1972