Thanks for the reply.
PHP-FPM
To enable a status page within PHP-FPM, I added this into roles/wordpress-setup/templates/php-fpm.conf.j2
:
pm.status_path = {{ php_fpm_pm_status_page }}
Then I added this into group_vars/staging/main.yml
(I’m testing this on staging, but would use production’s main.yml
file, too, once it’s working):
php_fpm_pm_status_page: /status
Then I ran ansible-playbook server.yml -e env=staging --tags wordpress-setup
to push it to the staging server.
I then manually checked that the line had been added to /etc/php/7.4/fpm/pool.d/wordpress.conf
, which it had, within the [wordpress]
section.
NGINX
I then amended the staging.conf.child
file within my nginx-includes/all
folder so that there is an entry that points to PHP-FPM. That entry reads:
server {
listen 80;
location /status {
allow 127.0.0.1;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_pass unix:/etc/php/7.4/fpm/pool.d/wordpress.sock;
}}
I then manually checked that the entry had been added to /etc/nginx/nginx.conf
, which it had.
Testing
But when I try to go to http://127.0.0.1/status
, I get a 404.
I’m not sure why, because, in the same staging.conf.child
file, I have NGINX-monitoring setup, with:
server {
listen 80;
location /basic_status {
stub_status on;
allow 127.0.0.1;
deny all;
}
}
And that works.
If I put those two into the same server
block, I get a 502 instead:
server {
listen 80;
location /basic_status {
stub_status on;
allow 127.0.0.1;
deny all;
}
location /status {
allow 127.0.0.1;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_pass unix:/etc/php/7.4/fpm/pool.d/wordpress.sock;
}
}
FYI: My Wordpress sites in Trellis are running on a different port, so it’s not that they’re interfering in some way with the requests on port 80.