From 9bb03eab0ac1ac442e73820328033983dee1f1d4 Mon Sep 17 00:00:00 2001 From: Stefano Ortolani Date: Fri, 6 Dec 2024 14:48:16 +0000 Subject: [PATCH] Fix bugs and defaults --- core/files/entrypoint.sh | 5 +++++ core/files/entrypoint_nginx.sh | 2 +- core/files/etc/nginx/sites-available/php-fpm-status | 2 +- docker-compose.yml | 6 ++++++ template.env | 11 +++++------ 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/core/files/entrypoint.sh b/core/files/entrypoint.sh index 07a65b5..33ee9b6 100755 --- a/core/files/entrypoint.sh +++ b/core/files/entrypoint.sh @@ -51,6 +51,11 @@ export PHP_UPLOAD_MAX_FILESIZE=${PHP_UPLOAD_MAX_FILESIZE:-50M} export PHP_POST_MAX_SIZE=${PHP_POST_MAX_SIZE:-50M} export PHP_MAX_INPUT_TIME=${PHP_MAX_INPUT_TIME:-300} +export PHP_FCGI_CHILDREN=${PHP_FCGI_CHILDREN:-5} +export PHP_FCGI_START_SERVERS=${PHP_FCGI_START_SERVERS:-2} +export PHP_FCGI_SPARE_SERVERS=${PHP_FCGI_SPARE_SERVERS:-1} +export PHP_FCGI_MAX_REQUESTS=${PHP_FCGI_MAX_REQUESTS:-0} + export PHP_SESSION_TIMEOUT=${PHP_SESSION_TIMEOUT:-60} export PHP_SESSION_COOKIE_TIMEOUT=${PHP_SESSION_COOKIE_TIMEOUT:-10080} export PHP_SESSION_DEFAULTS=${PHP_SESSION_DEFAULTS:-php} diff --git a/core/files/entrypoint_nginx.sh b/core/files/entrypoint_nginx.sh index 24be374..9c67626 100755 --- a/core/files/entrypoint_nginx.sh +++ b/core/files/entrypoint_nginx.sh @@ -343,7 +343,7 @@ init_nginx() { if [[ "$FASTCGI_STATUS_LISTEN" != "" ]]; then echo "... enabling php-fpm status page" ln -s /etc/nginx/sites-available/php-fpm-status /etc/nginx/sites-enabled/php-fpm-status - sed -i -E "s/ listen [^;]+/ listen $FASTCGI_STATUS_LISTEN" /etc/nginx/sites-enabled/php-fpm-status + sed -i -E "s/ listen [^;]+/ listen $FASTCGI_STATUS_LISTEN/" /etc/nginx/sites-enabled/php-fpm-status elif [[ -f /etc/nginx/sites-enabled/php-fpm-status ]]; then echo "... disabling php-fpm status page" rm /etc/nginx/sites-enabled/php-fpm-status diff --git a/core/files/etc/nginx/sites-available/php-fpm-status b/core/files/etc/nginx/sites-available/php-fpm-status index a45a56f..a29e1d6 100644 --- a/core/files/etc/nginx/sites-available/php-fpm-status +++ b/core/files/etc/nginx/sites-available/php-fpm-status @@ -5,4 +5,4 @@ server { include fastcgi_params; fastcgi_pass unix:/run/php/php-fpm-status.sock; } -} \ No newline at end of file +} diff --git a/docker-compose.yml b/docker-compose.yml index 792ae2c..e085e2a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -194,12 +194,18 @@ services: - "FASTCGI_READ_TIMEOUT=${FASTCGI_READ_TIMEOUT:-300s}" - "FASTCGI_SEND_TIMEOUT=${FASTCGI_SEND_TIMEOUT:-300s}" - "FASTCGI_CONNECT_TIMEOUT=${FASTCGI_CONNECT_TIMEOUT:-300s}" + - "FASTCGI_STATUS_LISTEN=${FASTCGI_STATUS_LISTEN}" # PHP settings - "PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT:-2048M}" - "PHP_MAX_EXECUTION_TIME=${PHP_MAX_EXECUTION_TIME:-300}" - "PHP_UPLOAD_MAX_FILESIZE=${PHP_UPLOAD_MAX_FILESIZE:-50M}" - "PHP_POST_MAX_SIZE=${PHP_POST_MAX_SIZE:-50M}" - "PHP_MAX_INPUT_TIME:${PHP_MAX_INPUT_TIME:-300}" + # PHP FPM pool setup + - "PHP_FCGI_CHILDREN=${PHP_FCGI_CHILDREN:-5}" + - "PHP_FCGI_START_SERVERS=${PHP_FCGI_START_SERVERS:-2}" + - "PHP_FCGI_SPARE_SERVERS=${PHP_FCGI_SPARE_SERVERS:-1}" + - "PHP_FCGI_MAX_REQUESTS=${PHP_FCGI_MAX_REQUESTS:-0}" # Additional PHP settings - "PHP_SESSION_TIMEOUT=${PHP_SESSION_TIMEOUT:-60}" - "PHP_SESSION_COOKIE_TIMEOUT=${PHP_SESSION_COOKIE_TIMEOUT:-10080}" diff --git a/template.env b/template.env index 3e4d5ea..8eed09e 100644 --- a/template.env +++ b/template.env @@ -183,7 +183,7 @@ SYNCSERVERS_1_PULL_RULES= # FASTCGI_READ_TIMEOUT=300s # FASTCGI_SEND_TIMEOUT=300s # FASTCGI_CONNECT_TIMEOUT=300s -# Whete to listen to PHP-FPM status. Can be a port or a ip:port. If not set the status page will not be shown. +# Where to listen to PHP-FPM status. Can be a port or a ip:port. If not set the status page will not be shown. # Do not expose this page in public networks. # FASTCGI_STATUS_LISTEN="" @@ -203,14 +203,13 @@ SYNCSERVERS_1_PULL_RULES= ## PHP FPM pool setup # Maximum number of php-fpm processes, limits the number of simultaneous requests. -PHP_FCGI_CHILDREN="5" +# PHP_FCGI_CHILDREN=5 # Number of processes created on startup. -PHP_FCGI_START_SERVERS="2" +# PHP_FCGI_START_SERVERS=2 # The desired number of idle server processes. -PHP_FCGI_SPARE_SERVERS="1" +# PHP_FCGI_SPARE_SERVERS=1 # The number of requests each process should execute before respawning. "0" means endless request processing. -PHP_FCGI_MAX_REQUESTS="0" - +# PHP_FCGI_MAX_REQUESTS=0 ## Additional PHP settings # Timeout (in minutes) for user session inactivity before it expires.