Merge pull request #521 from cytopia/docker-nginx

Nginx worker|connection settings via .env
This commit is contained in:
cytopia 2019-03-05 08:37:06 +01:00 committed by GitHub
commit e8fa029de6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 64 additions and 2 deletions

View File

@ -14,7 +14,7 @@ putenv('RES_OPTIONS=retrans:1 retry:1 timeout:1 attempts:1');
$DEVILBOX_VERSION = 'v0.15'; $DEVILBOX_VERSION = 'v0.15';
$DEVILBOX_DATE = '2019-03-01'; $DEVILBOX_DATE = '2019-03-04';
$DEVILBOX_API_PAGE = 'devilbox-api/status.json'; $DEVILBOX_API_PAGE = 'devilbox-api/status.json';
// //

View File

@ -27,6 +27,8 @@ major versions.
- Reverse Proxy support - Reverse Proxy support
- Autostart scripts - Autostart scripts
- Allow to enable/disable PHP modules - Allow to enable/disable PHP modules
- Allow to set Nginx worker_processes via .env
- Allow to set Nginx worker_connections via .env
- Intranet vendors - Intranet vendors
- PHPRedMin - PHPRedMin
- Mount options for volumes - Mount options for volumes
@ -88,6 +90,7 @@ major versions.
- Fixed hostnames for all Docker container - Fixed hostnames for all Docker container
- PHP-FPM workers changed from `dynamic` to `ondemand` - PHP-FPM workers changed from `dynamic` to `ondemand`
- Allow Apache to server underscore domains - Allow Apache to server underscore domains
- Changed Nginx `client_max_body_size` to `0` to be in sync with Apache
#### Fixed #### Fixed
- break on errors in wrong vhost-gen overwrite - break on errors in wrong vhost-gen overwrite

View File

@ -210,7 +210,7 @@ services:
# Web Server # Web Server
# ------------------------------------------------------------ # ------------------------------------------------------------
httpd: httpd:
image: devilbox/${HTTPD_SERVER}:0.29 image: devilbox/${HTTPD_SERVER}:0.30
hostname: httpd hostname: httpd
environment: environment:
@ -233,6 +233,12 @@ services:
- NEW_UID - NEW_UID
- NEW_GID - NEW_GID
##
## Nginx specific worker/connection settings
##
- WORKER_PROCESSES=${HTTPD_NGINX_WORKER_PROCESSES:-auto}
- WORKER_CONNECTIONS=${HTTPD_NGINX_WORKER_CONNECTIONS:-1024}
## ##
## Disable default vhost? ## Disable default vhost?
## ##

View File

@ -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_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 MySQL
----- -----

View File

@ -561,6 +561,18 @@ HTTPD_TEMPLATE_DIR=.devilbox
HTTPD_TIMEOUT_TO_PHP_FPM=180 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
################################################################################ ################################################################################
### ###

0
shell.bat Executable file → Normal file
View File