I'm using nginx with PHP-FPM

My application requires all urls to be redirected to index.php (see nginx conf)

location / {
    root /var/www/app/public/
    try_files $uri /index.php?$args;

location ~ \.php$ {         
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    try_files $fastcgi_script_name =404;

    set $path_info $fastcgi_path_info;
    fastcgi_param PATH_INFO $path_info;

    fastcgi_index index.php;

    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;

To analyze some performance issues I wanted to use the fpm status page. But the status page doesn't show me the real request URI

pid:                  1369
state:                Idle
start time:           03/Sep/2018:17:34:34 +0200
start since:          15
requests:             4
request duration:     29796
request method:       GET
request URI:          /index.php
content length:       0
user:                 -
script:               /var/www/app/public/index.php
last request cpu:     67.12
last request memory:  6291456

So it's hard to tell which page is currently processed - is it maybe possible to add some additional info to fpm-status page or change the request URI?

  • Why have you removed the default line include fastcgi_params;? Put it back first. – Michael Hampton Sep 3 '18 at 16:55
  • I changed location so it only uses include fastcgi_params and fastcgi_pass but result is the same – RCX Sep 3 '18 at 17:27

You have to add a block its own block with a fastcgi_index set:

location ~ ^/_status$ {     
    include fastcgi_params
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_index index.php;
    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;

    # the following is optional but nice to have
    # it will restrict access to the local monitoring system
    access_log off;
    allow ::1;
    deny all;


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.