From 418fdfb35e6b58a41c6e5455031520c82d9212ea Mon Sep 17 00:00:00 2001 From: PiBa-NL Date: Mon, 26 Jun 2017 23:53:51 +0200 Subject: [PATCH] php-fpm, add status page for local usage from console/shell, this provides a way to check what scripts are currently running in the php-fpm processes. For example the following can be executed from the local shell: ` fetch --no-verify-hostname --no-verify-peer "https://localhost/status?full" -o - ` --- src/etc/inc/system.inc | 11 +++++++++++ src/etc/rc.php_ini_setup | 9 ++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc index c7c6be20fed..aa9a7cec6b6 100644 --- a/src/etc/inc/system.inc +++ b/src/etc/inc/system.inc @@ -1527,6 +1527,17 @@ EOD; fastcgi_read_timeout 180; include /usr/local/etc/nginx/fastcgi_params; } + location ~ (^/status$) { + allow 127.0.0.1; + deny all; + fastcgi_pass unix:{$g['varrun_path']}/php-fpm.socket; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name; + # Fix httpoxy - https://httpoxy.org/#fix-now + fastcgi_param HTTP_PROXY ""; + fastcgi_read_timeout 360; + include /usr/local/etc/nginx/fastcgi_params; + } } EOD; diff --git a/src/etc/rc.php_ini_setup b/src/etc/rc.php_ini_setup index f54dcdb88bd..a876307fe7b 100755 --- a/src/etc/rc.php_ini_setup +++ b/src/etc/rc.php_ini_setup @@ -310,7 +310,6 @@ pm = ondemand pm.process_idle_timeout = 5 pm.max_children = $PHPFPMMAX pm.max_requests = 500 - EOF elif [ $REALMEM -gt 1000 ]; then @@ -323,7 +322,6 @@ pm.start_servers = 1 pm.max_requests = 500 pm.min_spare_servers=1 pm.max_spare_servers=1 - EOF else @@ -332,11 +330,16 @@ else pm = static pm.max_children = $PHPFPMMAX pm.max_requests = 500 - EOF fi +# Add status url for php-fpm this will only be made available from localhost through nginx 'allow 127.0.0.1' + /bin/cat >> /usr/local/lib/php-fpm.conf <