3

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"
Elisha Bentzi
  • 71
  • 1
  • 1
  • 6
  • 1
    Question is very vague but hey... Welcome! The upstream is responsible for allowing connections FROM outside sources. Meaning something that was running before (whatever it was) isn'T anymore or blocks nginx's attempts at communicating with it. 5XX series of http error codes are server errors. 502 Bad Gateway - The server was acting as a gateway/proxy and received an invalid response from the upstream server. Check whatever destination nginx is sending traffic to... also the path to that destination (firewall... anything...). Bit of general education would also do you wonders! – OldFart Mar 25 '21 at 11:11
  • (111: Connection refused) Means exactly what it says. There are MANY possible issues for why you are at this 'crossroad' today. Make sure you add more details in order to attract useful attention to this. 'Updating' nginx to another version (numberwise) has never suddenly caused stoppage of network communications for me in the past. Nothing has ever came close to do that, even with some complex configgurations. In general, nginx config test spits out some errors when something goes sideways (version specific, major changes) in terms of updating like a busy bee... Check destination! Enjoy! – OldFart Mar 25 '21 at 11:19

1 Answers1

4

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

Elisha Bentzi
  • 71
  • 1
  • 1
  • 6
  • This is the way you have to do it. The FPM Configuration says: Listen on Port 8050 BUT just on the local ip (localhost/127.0.0.1) Trying to connect from any other IP will not be accepted. Glad you found the issue by yourselfe – Timo Stark Mar 25 '21 at 11:35