After update nginx to version 1.19 my web server stop to work.
I am getting 502 gateway timeout error in browser when i was sending the request through browser
when i checked the nginx error log, i got this error
2021/03/24 06:25:50 [error] 56837#56837: *7775 connect() failed (111: Connection refused) while connecting to upstream, client: 85.208.98.19, server: bienestarmutuo.org, request: "GET /ten-principles-of-the-new-education/ HTTP/1.1", upstream: "fastcgi://10.64.10.43:8050", host: "mutualwelfare.org"
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