IS IT NGINX OR THE NODE API? A 502 MYSTERY WITH ONE CLUE

Solved502nginxreverse-proxy1 replies · 115 views · started
Accepted solution by Jonas Dubois — oh ive been there lol start with the nginx error log, it tells u which kind of 502 it is: [code] connect() failed (111: Connection…
  1. ugh. our Node API sits behind nginx on the same VM. It listens on 8000. Its been fine for months, but now only under load we get this:

    502 Bad Gateway

    502 Bad Gateway
    nginx
    

    if i SSH in and curl localhost:8000 I get a 200 insatntly. Restarting nginx fixes it for a while. Im out of ideas and support tickets are piling up.

    config hasnt changed in ages, as far as i know. the nginx config test passes, the apps own logs look normal, and CPU and memory on teh box are fine... what should i check first so i stop guessing??

    2
  2. Accepted solution

    oh ive been there lol start with the nginx error log, it tells u which kind of 502 it is:

    sudo tail -f /var/log/nginx/error.log
    

    connect() failed (111: Connection refused) means nothing listens where proxy_pass points. upstream prematurely closed connection means teh app accepted and then dropped the request. no live upstreams means all backends were marked down. hope that helps :)

    lol

    0 4 helpful

Reply to this topic

Sign in or create an account to reply.