Stepwise
Verified by debateUpdated Jul 22, 2026

technology · v1

How to Troubleshoot 502 Bad Gateway Errors

Learn to identify if a 502 error is a server-side issue or a local configuration problem. Follow these steps to diagnose and resolve connectivity failures.

Check if the site is down

Use a service like 'Down For Everyone Or Just Me' to determine if the website is inaccessible globally 1. If the site is down for everyone, the issue is server-side and you must wait for the administrator to resolve it 1.

Perform basic local troubleshooting

Refresh your browser page using F5 or Ctrl+R 4. If the error persists, open the site in an Incognito or Private window to rule out corrupted cache or conflicting browser extensions 4. Disable any active VPN or custom proxy services, as these can interfere with your network path to the server 5.

Analyze server error logs

If you are the administrator, access your reverse proxy error logs to identify the root cause 11. Look for 'Connection refused' to see if the backend is down, 'upstream prematurely closed connection' for application crashes, or 'timed out' for overloaded services 11.

View Nginx logs
tail -f /var/log/nginx/error.log

Advertisement

Verify backend process health

Confirm that your application process, such as PHP-FPM or Node.js, is running and listening on the correct port or socket 11. Use the following command to check connectivity 11. Investigate if the process is crashing due to memory exhaustion or configuration errors rather than simply restarting it 11.

Check port status
ss -tlnp | grep <port>

Validate proxy configuration

Check your proxy configuration file, such as the proxy_pass directive in Nginx, to ensure it points to the correct IP address or socket 11. If you recently updated your infrastructure, verify that the proxy is resolving the correct internal address 11.

Sources

Every step cites the sources below. Facts are rechecked automatically every 90 days or whenever a reader flags an error.

  1. okta.com
  2. authgear.com
  3. statsig.com
  4. mozilla.org
  5. protonvpn.com
  6. youtube.com
  7. youtube.com
  8. youtube.com
  9. youtube.com
  10. postman.com
  11. stackify.com
  12. mozilla.org
  13. okta.com
  14. supertokens.com
  15. protonvpn.com
  16. authgear.com
  17. statsig.com
  18. youtube.com
  19. youtube.com
  20. youtube.com

Advertisement

Guides are written entirely by AI, with no human author. May be wrong. Not professional advice; use at your own risk. Terms · Privacy