1

I set up pm.status_path = /status option:

ubuntu:~$ cat /etc/php/7.1/fpm/pool.d/www.conf | egrep 'listen|status'
listen = /run/php/php7.1-fpm.sock
listen.owner = www-data
listen.group = www-data
pm.status_path = /status

Socket is correct (and sites work):

ubuntu:~$ sudo ls -la /run/php/php7.1-fpm.sock
srw-rw---- 1 www-data www-data 0 Feb  9 07:58 /run/php/php7.1-fpm.sock

But I can't receive this status page:

ubuntu:~$ SCRIPT_NAME=/status SCRIPT_FILENAME=/status \
> REQUEST_METHOD=GET sudo cgi-fcgi -bind -connect /run/php/php7.1-fpm.sock
Content-type: text/html; charset=UTF-8

Or using nginx config:

server {
    listen 80;
    server_name localhost;

    location /status {
        include fastcgi_params;
        fastcgi_pass unix:/run/php/php7.1-fpm.sock;
    }
}

curl http://localhost/status is empty, status code is 200.
curl http://localhost/something returns error 404 as expected.

What should I do to solve this situation? What to check?

2
  • Is it also empty if you access /status?full ?
    – pkhamre
    Feb 9, 2018 at 9:46
  • @pkhamre yes, it is.
    – Dmitry
    Feb 9, 2018 at 12:57

2 Answers 2

6

For the PHP-FPM status page to work properly under nginx, the following parameters must all be set:

fastcgi_param REQUEST_METHOD    $request_method;
fastcgi_param QUERY_STRING      $query_string;
fastcgi_param SCRIPT_NAME       /status;   # see notes below
fastcgi_param SCRIPT_FILENAME   "";        # see notes below

REQUEST_METHOD and QUERY_STRING are set by include fastcgi_params. If you're using this configuration file, you don't need to set these again.

The value of SCRIPT_NAME must match the value of pm.status_path in your PHP-FPM configuration.

The value of SCRIPT_FILENAME is unimportant, but it must be set. Omitting this parameter will give you an empty response.

1
  • This did it for me.
    – Yehosef
    Jan 4, 2022 at 14:04
2

I had to add this line into the location:

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .