HTTP troubleshooting
502 Bad Gateway
Your uptime monitor detected that one server on the internet received an invalid response from another server it was trying to talk to. This usually happens when an edge server, like a proxy or Content Delivery Network, cannot get a valid answer from your main backend application server.
What 502 Status Code Means
- 1.
Backend application crash
The underlying backend process, like PHP-FPM, Node.js, or Python, crashed or stopped running entirely.
- 2.
Web server misconfiguration
The front-facing web server, like NGINX or Apache, is looking for the backend application at the wrong port or socket path.
- 3.
Server overload
The backend server is buried under too many requests, causing it to drop incoming connections without answering.
Troubleshooting checklist
- 1.
Check backend service status
Verify if your backend application process is actually running and active on the server.
- 2.
Review proxy configurations
Check your NGINX or Apache proxy pass settings to make sure they point to the correct internal address.
- 3.
Inspect backend error logs
Look directly into your backend application logs for crash reports or out-of-memory errors.
- 4.
Check firewall blocks
Ensure your internal server firewall isn't accidentally blocking communication between the web server and the backend.
How to Fix It
- 1.
Restart backend processes
Reboot your backend service, like PHP-FPM or Node.js, to bring the application layer back online.
- 2.
Fix connection paths
Correct any wrong IP addresses, port numbers, or file socket paths in your web server config files.
- 3.
Optimize backend resources
Allocate more memory and worker processes to your backend engine so it can handle larger spikes in traffic.
- 4.
Clear edge server cache
Purge the cache on your CDN or reverse proxy if it is stuck serving an old 502 error page.
After the Service is Fixed
- 1.
Verify with Uptime Monitor
Confirm that the monitor shows a healthy green status once the front and backend servers are talking again.
- 2.
Monitor backend service stability
Keep an eye on your backend process uptime to ensure it does not keep crashing and restarting repeatedly.
- 3.
Set up automated restarts
Configure a process manager, like PM2 or systemd, to automatically restart your backend service if it drops.
- 4.
Tune connection timeouts
Increase the timeout limits between your proxy and backend so slow requests don't trigger a sudden 502 code.