Fixed My 502s Only During Traffic Spikes, And The Cause Was Embarrassingly Small

502nginxreverse-proxy53 replies 路 443 views 路 started
  1. yeahhh try turning off the cable first, fixed it for me. @hmendes what did u end up doing in the end fingers crossed 馃

    1 4 helpful
  2. honestly just reset teh BIOS and save yourself the pain fingers crossed 馃

    4 0 helpful
  3. oh ive been there lol look for teh kernel's OOM killer: dmesg -T | grep -i -E 'killed process|out of memory'. Small VPSes kill PHP-FPM workers, Node or database processes under load, which produces 502s during traffic spikes. Add swap, reduce worker counts, or move to a bigger plan.

    0 0 helpful
  4. Check teh app service right after a 502: systemctl status php*-fpm, systemctl status yourapp, or docker compose ps... if it shows restarts or exited state, read its own logs with journalctl -u yourapp -n 200 or docker compose logs app lmao the real error lives there, not in the proxy log. lmk how it goes

    4 0 helpful
  5. ok this thread just saved my weekend. bump... still happening with during for me

    18 0 helpful
  6. yeahhh a 502 means the proxy reached out to teh app behind it and got a broken or no response. read the proxy's error log first: sudo tail -n 100 /var/log/nginx/error.log for Nginx. connect() failed (111: Connection refused) means nothing is listening; upstream prematurely closed connection means the app crashed or killed teh request mid-way.

    3 2 helpful
  7. oof came here to say exactly this. honestly just reset the settings and save yourself teh pain

    3 1 helpful
  8. reading this at 2am instead of sleeping, no regrets. make a bacukp before u touch the extension, learned that the hard way im about to throw this thing out the window lol

    1 0 helpful
  9. lol same thing happened to me pro tip: write down what u change... i didnt and had to redo 502 from scratch good luck man!

    1 0 helpful
  10. yeahhh this. sooo much this. wait does this also apply to 502? worked for me anyway 馃し

    15 0 helpful
  11. yeahhh after reboots and deploys, teh classic cauess are a socket path mismatch (fastcgi_pass unix:/run/php/... pointing at a socket name that changed), the app not being enabled at boot (systemctl enable yourapp), or a container listening on 127.0.0.1 inside Docker so teh proxy container can't reach it. Bind to 0.0.0.0 in the container and use teh service name in teh proxy config.

    4 0 helpful
  12. respectfully disagree, i tried that and it made during worse

    4 0 helpful

Reply to this topic

Sign in or create an account to reply.