nginx 502 bad gateway after the upstream redeploy
Started seeing 502s right after a gunicorn redeploy, and they come and go every few seconds. Nginx 1.24.0 on Ubuntu 22.04, upstream is 127.0.0.1:8080. Error log is full of connect() failed (111: Connection refused) while connecting to upstream, client: 10.0.0.4, server: _, request: GET /api/health HTTP/1.1, upstream: http://127.0.0.1:8080/api/health. Gunicorn is listening on 0.0.0.0:8080 and curl localhost:8080/api/health works from the box. What would make nginx refuse the connection while curl succeeds?
4 replies