diff --git a/docker-compose.yml b/docker-compose.yml index 18947b68..bdfb614f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -210,7 +210,7 @@ services: # Web Server # ------------------------------------------------------------ httpd: - image: devilbox/${HTTPD_SERVER}:0.29 + image: devilbox/${HTTPD_SERVER}:0.30 hostname: httpd environment: @@ -233,6 +233,12 @@ services: - NEW_UID - NEW_GID + ## + ## Nginx specific worker/connection settings + ## + - WORKER_PROCESSES=${HTTPD_NGINX_WORKER_PROCESSES:-auto} + - WORKER_CONNECTIONS=${HTTPD_NGINX_WORKER_CONNECTIONS:-1024} + ## ## Disable default vhost? ## diff --git a/docs/configuration-files/env-file.rst b/docs/configuration-files/env-file.rst index 366ad0fd..3d7e5e67 100644 --- a/docs/configuration-files/env-file.rst +++ b/docs/configuration-files/env-file.rst @@ -1518,6 +1518,47 @@ than ``max_execution_time``, you will get a proper PHP error message in the brow | ``HTTPD_TIMEOUT_TO_PHP_FPM`` | positive integer | ``180`` | +------------------------------+-------------------+------------------+ +HTTPD_NGINX_WORKER_PROCESSES +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Defines the number of worker processes for Nginx, i.e, the number of CPU cores. + +The optimal value depends on many factors including (but not limited to) the number of CPU cores, +the number of hard disk drives that store data, and load pattern. When one is in doubt, setting it +to the number of available CPU cores would be a good start +(the value “auto” will try to autodetect it). + ++----------------------------------+-----------------------------+------------------+ +| Name | Allowed values | Default value | ++==================================+=============================+==================+ +| ``HTTPD_NGINX_WORKER_PROCESSES`` | positive integer \| `auto` | ``auto`` | ++----------------------------------+-----------------------------+------------------+ + +.. note:: This setting only applies to Nginx and has no effect for Apache. + +.. seealso:: https://nginx.org/en/docs/ngx_core_module.html#worker_processes + + +HTTPD_NGINX_WORKER_CONNECTIONS +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Sets the maximum number of simultaneous connections that can be opened by a worker process. + +It should be kept in mind that this number includes all connections (e.g. connections with proxied +servers, among others), not only connections with clients. Another consideration is that the actual +number of simultaneous connections cannot exceed the current limit on the maximum number of open +files, which can be changed by worker_rlimit_nofile. + ++------------------------------------+-------------------+------------------+ +| Name | Allowed values | Default value | ++====================================+===================+==================+ +| ``HTTPD_NGINX_WORKER_CONNECTIONS`` | positive integer | ``1024`` | ++------------------------------------+-------------------+------------------+ + +.. note:: This setting only applies to Nginx and has no effect for Apache. + +.. seealso:: https://nginx.org/en/docs/ngx_core_module.html#worker_connections + MySQL ----- diff --git a/env-example b/env-example index 29d6df3d..c2bc7768 100644 --- a/env-example +++ b/env-example @@ -561,6 +561,18 @@ HTTPD_TEMPLATE_DIR=.devilbox HTTPD_TIMEOUT_TO_PHP_FPM=180 +### +### NGINX ONLY +### +### Set worker_processes and worker_connections +### +### https://nginx.org/en/docs/ngx_core_module.html#worker_processes +### https://nginx.org/en/docs/ngx_core_module.html#worker_connections +### +HTTPD_NGINX_WORKER_PROCESSES=auto +HTTPD_NGINX_WORKER_CONNECTIONS=1024 + + ################################################################################ ###