Nginx – How to debug nginx and php-fpm besides nginx -t, access log, error log and php*-fpm status

nginxphp-fpm

Nearly two weeks I'm stuck with this LEMP problem in which I get only one error anywhere and I don't feel this error helps me to solve my problem:

*1 connect() failed (111: Connection refused) while connecting to upstream,
client: MY_IP_ADDRESS, server: example.com, request: "GET /
HTTP/2.0", upstream: "fastcgi://127.0.0.1:9000".

nginx -t, access.log, and /etc/init.d/php*-fpm status
returns no additional errors.

It's not the first time I get a "vague" connection refused error from Nginx while no other error log indicates what might be the source of the problem:

How to further debug Nginx in such circumstances?

BTW, I tried to contact the Nginx developers on this but they have shutted down any reasonable option to contact them (for example, they don't get emails from Gmail senders or GitHub issues).

Best Answer

Your nginx config specifies that it is supposed to connect to PHP-FPM using TCP to 127.0.0.1:9000 but your PHP-FPM config specifies that it doesn't listen on TCP port 9000 but instead uses unix socket /run/php/php7.0-fpm.sock so you get connection refused.