Enable php-fpm status page

I have been using caddy for some months on a couple of low traffic sites to try it out and had no problems I’ve noticed until today:
I am now setting up a very simple web server which will only serve jpeg images. Images or metadata are requested in various ways which are handled by a simple PHP framework. As it is (apparently) simple I have assumed a fairly low-spec virtual server can handle it but it is running into problems with a test request for 150 images at once.
However I tweak php-fpm, caddy baulks at about 130 requests.
For now, I am assuming the problem is with my php setup rather than caddy so I am trying to get more info from php-fpm. In the configs I found I can enable a status page but this gives a 404 because my php framework requires rewriting everything to index.php.

I think I need to add a rewrite rule in my Caddyfile to send requests for /statusPage directly to php-fpm process instead of running through php.

Any pointers gratefully received :wink:
Just thinking about this sends my head into an infinite loop!


Hi @Alan_Bradshaw, welcome to the Caddy community.

I’m not sure a rewrite would be needed - I’d assume a simple fastcgi /status would work (where /status is the value of pm.status_path in www.conf), omitting the php preset.

Thanks @Whitestrake,
I put that line before the “normal” fastcgi line and it did nothing. Is that where it should be?
Not sure what port 9000 is for … I tried without it and tried calling it localhost. None worked for me.
Now I’ve made a dedicated php-fpm process just for the status page so that I can use its socket like this:

  # intercept request for status page
  fastcgi /serverstatus /var/run/php/php7.1-fpm-status.sock

  # all requests send to php-fpm socket 
  fastcgi / /var/run/php/php7.1-fpm-img.sock {
    ext   .php
    split   .php
    index   index.php

systemctl restart php7.1-fpm.service - all expected sockets and processes created
systemctl restart caddy.service - caddy starts and runs
But still no php-fpm status page :frowning: 404

Sorry, that’s just where most php-fpm packages listen by default on startup. If you’re using a socket, you’ve modified it correctly, as far as I can tell.

Does the second fastcgi work fine? I don’t recall if unix sockets want an unix: prefix like they do with the proxy directive.

The only other thing I can think of is to double check pm.status_path in www.conf.

I’ve been diverted onto other projects now but wanted to say “Thanks for your help.”
It looks like I’m not exactly doing anything wrong so must just go through all the various configs to find the typo :wink: … when I get around to it.

You may find this of use, php fastcgi needs to be restarted reguarily.

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