From 8b2b576b7df846dcdbe9e9980d527d9c8c9c6dcc Mon Sep 17 00:00:00 2001 From: Chauncey Thorn Date: Mon, 9 Jul 2018 12:17:46 -0400 Subject: [PATCH 1/3] NOTICKET: Allow one to update php-fpm variables --- root/etc/confd/templates/www.conf.tmpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/root/etc/confd/templates/www.conf.tmpl b/root/etc/confd/templates/www.conf.tmpl index 70d621d..0caee33 100644 --- a/root/etc/confd/templates/www.conf.tmpl +++ b/root/etc/confd/templates/www.conf.tmpl @@ -73,23 +73,23 @@ pm.max_children = {{getenv "PHP_MAX_CHILDREN"}} ; The number of child processes created on startup. ; Note: Used only when pm is set to 'dynamic' ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 -;pm.start_servers = 5 +pm.start_servers = {{getenv "PHP_PHPFPM_START_SERVERS"}} ; The desired minimum number of idle server processes. ; Note: Used only when pm is set to 'dynamic' ; Note: Mandatory when pm is set to 'dynamic' -;pm.min_spare_servers = 5 +pm.min_spare_servers = {{getenv "PHP_PHPFPM_MIN_SPARE_SERVERS"}} ; The desired maximum number of idle server processes. ; Note: Used only when pm is set to 'dynamic' ; Note: Mandatory when pm is set to 'dynamic' -;pm.max_spare_servers = 35 +pm.max_spare_servers = {{getenv "PHP_PHPFPM_MAX_SPARE_SERVERS"}} ; The number of requests each child process should execute before respawning. ; This can be useful to work around memory leaks in 3rd party libraries. For ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. ; Default Value: 0 -pm.max_requests = 200 +pm.max_requests = {{getenv "PHP_PHPFPM_MAX_REQUESTS"}} ; The URI to view the FPM status page. If this value is not set, no URI will be ; recognized as a status page. By default, the status page shows the following From 23584480892333708da290d5df356da162ca8566 Mon Sep 17 00:00:00 2001 From: Chauncey Thorn Date: Mon, 9 Jul 2018 12:21:43 -0400 Subject: [PATCH 2/3] NOTICET: Updating Dockerfile with default php-fpm variables --- Dockerfile | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index e8e7996..744f1d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,14 +13,18 @@ COPY root / VOLUME ["/var/log/httpd", "/var/lib/php/session"] -ENV PROXY_TIMEOUT 120 -ENV PHP_MAX_EXECUTION_TIME 60 -ENV PHP_MAX_CHILDREN 5 -ENV PHP_MEMORY_LIMIT 256m -ENV PHP_OPCACHE_MEMORY 192 -ENV PHP_XDEBUG false -ENV PHP_XHPROF false -ENV PHP_TIMEZONE UTC -ENV PHP_POST_MAX_SIZE 12M -ENV PHP_UPLOAD_MAX_FILESIZE 10M -ENV DOCROOT /var/www/html +ENV PROXY_TIMEOUT 120 +ENV PHP_MAX_EXECUTION_TIME 60 +ENV PHP_MAX_CHILDREN 5 +ENV PHP_MEMORY_LIMIT 256m +ENV PHP_OPCACHE_MEMORY 192 +ENV PHP_XDEBUG false +ENV PHP_XHPROF false +ENV PHP_TIMEZONE UTC +ENV PHP_POST_MAX_SIZE 12M +ENV PHP_UPLOAD_MAX_FILESIZE 10M +ENV DOCROOT /var/www/html +ENV PHP_PHPFPM_START_SERVERS 5 +ENV PHP_PHPFPM_MIN_SPARE_SERVERS 5 +ENV PHP_PHPFPM_MAX_SPARE_SERVERS 35 +ENV PHP_PHPFPM_MAX_REQUESTS 200 From 8be756376c6496aebc642ce0f795f06a70ff7eb5 Mon Sep 17 00:00:00 2001 From: Chauncey Thorn Date: Tue, 10 Jul 2018 20:17:43 -0400 Subject: [PATCH 3/3] NOTICKET: Updates after code review --- Dockerfile | 8 ++++---- README.md | 5 +++++ root/etc/confd/templates/www.conf.tmpl | 8 ++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 744f1d2..1f92851 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,7 +24,7 @@ ENV PHP_TIMEZONE UTC ENV PHP_POST_MAX_SIZE 12M ENV PHP_UPLOAD_MAX_FILESIZE 10M ENV DOCROOT /var/www/html -ENV PHP_PHPFPM_START_SERVERS 5 -ENV PHP_PHPFPM_MIN_SPARE_SERVERS 5 -ENV PHP_PHPFPM_MAX_SPARE_SERVERS 35 -ENV PHP_PHPFPM_MAX_REQUESTS 200 +ENV PHPFPM_START_SERVERS 5 +ENV PHPFPM_MIN_SPARE_SERVERS 5 +ENV PHPFPM_MAX_SPARE_SERVERS 35 +ENV PHPFPM_MAX_REQUESTS 200 diff --git a/README.md b/README.md index da5cb3b..f4605d3 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,11 @@ configurations offered by this image. * `PHP_YAML`: [`"false"`|`"true"`] A string literal to enable PHP YAML extension. Defaults to `"false"`. * `PROXY_TIMEOUT`: [`120`] Apache `ProxySet timeout` value for the php-fpm proxy. +* `PHPFPM_START_SERVERS`: [`5`] `Start Servers` The number of child processes created on startup. +* `PHPFPM_MIN_SPARE_SERVERS`: [`5`] `Min Spare Servers` The desired minimum number of idle server processes. +* `PHPFPM_MAX_SPARE_SERVERS`: [`35`] `Max Spare Servers` The desired maximum number of idle server processes. +* `PHPFPM_MAX_REQUESTS`: [`200`] `Max Request` The number of requests each child process should execute before respawning. + ## Security Reports diff --git a/root/etc/confd/templates/www.conf.tmpl b/root/etc/confd/templates/www.conf.tmpl index 0caee33..0bcb41a 100644 --- a/root/etc/confd/templates/www.conf.tmpl +++ b/root/etc/confd/templates/www.conf.tmpl @@ -73,23 +73,23 @@ pm.max_children = {{getenv "PHP_MAX_CHILDREN"}} ; The number of child processes created on startup. ; Note: Used only when pm is set to 'dynamic' ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 -pm.start_servers = {{getenv "PHP_PHPFPM_START_SERVERS"}} +pm.start_servers = {{getenv "PHPFPM_START_SERVERS"}} ; The desired minimum number of idle server processes. ; Note: Used only when pm is set to 'dynamic' ; Note: Mandatory when pm is set to 'dynamic' -pm.min_spare_servers = {{getenv "PHP_PHPFPM_MIN_SPARE_SERVERS"}} +pm.min_spare_servers = {{getenv "PHPFPM_MIN_SPARE_SERVERS"}} ; The desired maximum number of idle server processes. ; Note: Used only when pm is set to 'dynamic' ; Note: Mandatory when pm is set to 'dynamic' -pm.max_spare_servers = {{getenv "PHP_PHPFPM_MAX_SPARE_SERVERS"}} +pm.max_spare_servers = {{getenv "PHPFPM_MAX_SPARE_SERVERS"}} ; The number of requests each child process should execute before respawning. ; This can be useful to work around memory leaks in 3rd party libraries. For ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. ; Default Value: 0 -pm.max_requests = {{getenv "PHP_PHPFPM_MAX_REQUESTS"}} +pm.max_requests = {{getenv "PHPFPM_MAX_REQUESTS"}} ; The URI to view the FPM status page. If this value is not set, no URI will be ; recognized as a status page. By default, the status page shows the following