Nginx – php-fastcgi status: “No input file specified”

monitoringnginxphp-fastcgiphp-fpmstat

# grep pm.status_path /etc/php5/fpm/pool.d/www.conf
pm.status_path = /fcgi-status

nginx config:

location ~ ^/(fcgi-status|ping)$ {
     access_log off;
     allow 127.0.0.1;
     deny all;
     fastcgi_param SCRIPT_FILENAME /path/$fastcgi_script_name;
     fastcgi_pass unix:/var/run/php-fastcgi/php-fastcgi.socket;
}

fastcgi_param and fastcgi_pass are the same as for the website which works.

php-fastcgi and nginx were restarted, but:

# curl http://127.0.0.1/fcgi-status -i
HTTP/1.1 404 Not Found
Server: nginx/1.10.1
Date: Tue, 18 Oct 2016 08:10:03 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.5.9-1ubuntu4.20

No input file specified.

This is not duplicate of this question because the error is not 'File not found' (perhaps nginx was unable to find the path) but 'No input file specified'. Please note there is php header in the response, so the answer came not from nginx but from php-fpm.

This is the only pool on the server.

What am I doing wrong?

Best Answer

Your fastcgi_param SCRIPT_FILENAME has a path prefix in it, however in php-fpm configuration you don't have a prefix.

So you need to change either one so that they are the same.