nginx: connect() failed (111: Connection refused) while connecting to upstream – after update nginx –

After many hours trying to find the source of the problem (many install and purge)

The problem was, for me, the use of different port “name” in nginx and php.

in php (/etc/php/8.0/fpm/pool.d/bienestarmutuo-org8050.conf) i have

listen = localhost:8050

in nginx (/etc/nginx/sites-available/bienestarmutuo.org.conf) i have

fastcgi_pass 10.64.10.43:8050;

This was changed to:

in nginx

fastcgi_pass 127.0.0.1:8050;

in php

listen = 127.0.0.1:8050

restart php and nginx, everything Work again.

note: use of 127.0.0.1 instead of localhost, save an DNS lookup.

the solution for me, was use the same reference for the ip:port in both php and nginx -> 127.0.0.1

Leave a Comment