From 458babf82c43b6040490b2c363f826a87fcae8f5 Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Sat, 6 Jun 2020 18:22:42 +0200 Subject: [PATCH] nginx/php: Added support for php-fpm status page --- group_vars/all/vars.yml | 2 ++ roles/nginx/php/defaults/main.yml | 3 +++ roles/nginx/php/templates/server.conf | 17 +++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/group_vars/all/vars.yml b/group_vars/all/vars.yml index 507b878..5c74119 100644 --- a/group_vars/all/vars.yml +++ b/group_vars/all/vars.yml @@ -50,6 +50,8 @@ nginx_status_page_acl: | allow {{ global_wireguard_ipv4_range }}; deny all; +phpfpm_status_page_path: "/.well-known/php-fpm-status" + ssh_host_key_types: - ed25519 - rsa diff --git a/roles/nginx/php/defaults/main.yml b/roles/nginx/php/defaults/main.yml index 383469e..abe0185 100644 --- a/roles/nginx/php/defaults/main.yml +++ b/roles/nginx/php/defaults/main.yml @@ -6,3 +6,6 @@ # pool_name from nginx/php-pool # includes: ... # env_vars: ... + +status_page_path: "{{ phpfpm_status_page_path }}" +status_page_acl: "{{ nginx_status_page_acl }}" diff --git a/roles/nginx/php/templates/server.conf b/roles/nginx/php/templates/server.conf index 720ac21..e5c5ff2 100644 --- a/roles/nginx/php/templates/server.conf +++ b/roles/nginx/php/templates/server.conf @@ -14,6 +14,23 @@ server { root {{ src }}; fastcgi_hide_header X-Powered-By; + {% if status_page_path is defined and status_page_path|length -%} + location {{ status_page_path }} { + {{ status_page_acl | indent(width=4) }} + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + fastcgi_index index.php; + include {{ nginx_installation_directory }}/fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param HTTPS on; + fastcgi_param modHeadersAvailable true; + fastcgi_param front_controller_active true; + fastcgi_pass {{ pool_name }}; + fastcgi_intercept_errors on; + fastcgi_request_buffering off; + } + {%- endif %} + location ~\.php$ { fastcgi_split_path_info ^(.+?\.php)(/.*)$; try_files $uri =404;