Add ability to configure "worker_processes"
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.
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!
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.
Having this issue as well, would love to see this implemented!
same here please help us to change worker_connections
@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.
@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!!!
@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?
@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 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?
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
Issue is now considered stale. If you want to keep it open, please comment :+1:
Issue is now considered stale. If you want to keep it open, please comment 👍
please fix
please fix or advise if there is another way to achieve this. Or to be considered as road map item?
@msycn That is already possible thanks to the commit @Blooym made. Just put that line in
/data/nginx/custom/events.confand 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?
@msycn That is already possible thanks to the commit @Blooym made. Just put that line in
/data/nginx/custom/events.confand 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