diff --git a/README.md b/README.md index d5880cc..e25ee85 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,7 @@ linux/s390x * `MEMORY_LIMIT`: PHP memory limit (default `512M`) * `UPLOAD_MAX_SIZE`: Upload max size (default `512M`) * `PM_MAX_CHILDREN`: Maximum number of child processes to be created for PHP-FPM (default `20`) +* `NGINX_WORKER_PROCESSES`: Number of Nginx worker processes (default `auto`) * `BODY_TIMEOUT`: Defines a timeout for reading client request body (default `300s`) * `CLEAR_ENV`: Clear environment in FPM workers (default `yes`) * `OPCACHE_MEM_SIZE`: PHP OpCache memory consumption (default `128`) diff --git a/rootfs/etc/cont-init.d/03-config.sh b/rootfs/etc/cont-init.d/03-config.sh index 8db39eb..eaaaeda 100644 --- a/rootfs/etc/cont-init.d/03-config.sh +++ b/rootfs/etc/cont-init.d/03-config.sh @@ -55,6 +55,7 @@ TZ=${TZ:-UTC} MEMORY_LIMIT=${MEMORY_LIMIT:-512M} UPLOAD_MAX_SIZE=${UPLOAD_MAX_SIZE:-512M} PM_MAX_CHILDREN=${PM_MAX_CHILDREN:-20} +NGINX_WORKER_PROCESSES=${NGINX_WORKER_PROCESSES:-auto} BODY_TIMEOUT=${BODY_TIMEOUT:-300s} CLEAR_ENV=${CLEAR_ENV:-yes} OPCACHE_MEM_SIZE=${OPCACHE_MEM_SIZE:-128} @@ -116,6 +117,7 @@ sed -e "s/@MEMORY_LIMIT@/$MEMORY_LIMIT/g" \ # Nginx echo "Setting Nginx configuration..." sed -e "s/@UPLOAD_MAX_SIZE@/$UPLOAD_MAX_SIZE/g" \ + -e "s/@NGINX_WORKER_PROCESSES@/$NGINX_WORKER_PROCESSES/g" \ -e "s/@BODY_TIMEOUT@/$BODY_TIMEOUT/g" \ -e "s#@REAL_IP_FROM@#$REAL_IP_FROM#g" \ -e "s#@REAL_IP_HEADER@#$REAL_IP_HEADER#g" \ diff --git a/rootfs/tpls/etc/nginx/nginx.conf b/rootfs/tpls/etc/nginx/nginx.conf index 39b3614..d0d8075 100644 --- a/rootfs/tpls/etc/nginx/nginx.conf +++ b/rootfs/tpls/etc/nginx/nginx.conf @@ -1,7 +1,7 @@ # similar to https://github.com/nextcloud/docker/blob/master/.examples/docker-compose/with-nginx-proxy/mariadb/fpm/web/nginx.conf pid /var/run/nginx/nginx.pid; -worker_processes auto; +worker_processes @NGINX_WORKER_PROCESSES@; error_log /proc/self/fd/2 info; events {