[solved] Php-fpm status page won't load

Trying to get the php-fpm status per the www.conf file in 7.2

This posted helped but still not succeeding

my www.conf file has
pm.status_path = /phpfpm

my caddy entry is

https://status.kebler.net {
        import wildcard_cert
        fastcgi /phpfpm /var/run/php/php7.2-fpm-status.sock php
        fastcgi / /var/run/php/php7.2-fpm.sock php
        root /mnt/data/webs/status
        }

caddy and fpm services are restarted (no errors)
All other php based websites on server working fine.

put
https://status.kebler.net/phpfpm?html&full in browser I get 404 not found.
put in
https://status.kebler.net I get my root custom status page I built in php (works fine)

First I see no
/var/run/php/php7.2-fpm-status.sock
when I uncomment the status_path in www.conf it that supposed to fire up a status socket? If so I don’t see one. Well I tried it with the -status removed and either way no go.

just for grins I put a little php in /mnt/data/webs/status/phpfpm and the browser shows this so I can only conclude that the fastcgi /phpfpm line is not working and just dropping through.

I can see the status via the commandline so it’s a caddy isssue me thinks.

sysadmin@nas:~$ SCRIPT_NAME=/phpfpm   SCRIPT_FILENAME=/phpfpm   REQUEST_METHOD=GET   cgi-fcgi -bind -connect /var/run/php/php7.2-fpm.sock
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate, max-age=0
Content-type: text/plain;charset=UTF-8

pool:                 www
process manager:      dynamic
start time:           01/Nov/2018:14:45:30 -0700
start since:          60
accepted conn:        9
listen queue:         0
max listen queue:     0
listen queue len:     0
idle processes:       1
active processes:     1
total processes:      2
max active processes: 1
max children reached: 0
slow requests:        0

Any other thoughts/input?

No, that is not meant to fire up a socket on its own.

I’d be wary of copying parts from other people’s configuration without understanding why they did what they did. In this case, in the other thread the user added an extra process, specifically to listen on -status.sock:

Lastly, the problem really is just to do with the FastCGI variables. Usually for PHP we rely on the php preset which sets a few of them for us, but it only really works well on index and *.php file requests.

Since want to specifically send every request under a certain base path to fastcgi, we need to specify the script name, exactly like you did on the command line. This example Caddyfile works for me.

:2015 {
  fastcgi /status :9000 {
    env SCRIPT_NAME /status
  }
}

TADA

https://status.kebler.net {
        import wildcard_cert
        fastcgi /phpfpm /var/run/php/php7.2-fpm.sock {
        env SCRIPT_NAME /phpfpm
        }
        fastcgi / /var/run/php/php7.2-fpm.sock php
        root /mnt/data/webs/status
        }

Guess if I have looked the directive docs would have dawned on to set the env variable there once I learned how to do it in the cli. https://caddyserver.com/docs/fastcgi. Thx

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.