diff --git a/CHANGELOG.md b/CHANGELOG.md index e315cef6..5c4bc075 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## untagged +- Increase nginx connection limits + ([#576](https://github.com/chatmail/relay/pull/576)) + - If `dns-utils` needs to be installed before cmdeploy run, apt update to make sure it works ([#560](https://github.com/chatmail/relay/pull/560)) diff --git a/cmdeploy/src/cmdeploy/nginx/nginx.conf.j2 b/cmdeploy/src/cmdeploy/nginx/nginx.conf.j2 index 13221cc3..8d27394c 100644 --- a/cmdeploy/src/cmdeploy/nginx/nginx.conf.j2 +++ b/cmdeploy/src/cmdeploy/nginx/nginx.conf.j2 @@ -2,11 +2,25 @@ load_module modules/ngx_stream_module.so; user www-data; worker_processes auto; + +# Increase the number of connections +# that a worker process can open +# to avoid errors such as +# accept4() failed (24: Too many open files) +# and +# socket() failed (24: Too many open files) while connecting to upstream +# in the logs. +# +worker_rlimit_nofile 2048; pid /run/nginx.pid; error_log syslog:server=unix:/dev/log,facility=local3; events { - worker_connections 768; + # Increase to avoid errors such as + # 768 worker_connections are not enough while connecting to upstream + # in the logs. + # + worker_connections 2048; # multi_accept on; }