This includes DNS resolution, Apache processes, PHP services, DB server, etc. Your Nginx server and the backend services relies on many sub-systems to work properly. We are online 24/7 and can help you in a few minutes. If your server is currently under high load, and you need urgent help, click here to contact our Emergency Server Support techs. The we find out which service is abusing that resource, and from that point, find out which user in that service owns the abusive script or software.Ĭlick here to know more about high load troubleshooting. To troubleshoot a high load issue, first we figure out which resource is being abused (I/O, Memory, CPU or Net). Application bugs that cause memory leaks or resource hogging.Brute force attacks that’s designed to exploit web apps.Comment spamming or other vulnerability exploits.Sudden spike in website traffic (can be seasonal or marketing / promotional).We’ve seen these reasons for load spikes: Load spikes cause services to not respond. The second most common reason for “502 bad gateway” in Nginx is high load average in backend servers. Click here if you need help resolving your server error. If the service restart didn’t work, you may need to get someone to take a closer look at the server health. Warning : Do not use these commands if you are not sure how it works. * Restarting PHP FastCGI Process Manager php-fpm If you suspect a backend service is unresponsive or failed, you can try killing all unresponsive processes and restarting the service.įor instance, here’s one way we kill defunct PHP-FPM processes and restart services. The reasons for service failure can range from traffic spikes and resource limits to disk errors and DDoS attacks. Some services that we’ve seen to fail are: So, if any of these services crash or freeze, Nginx won’t get any data from them, resulting in “502 Bad gateway” error. Nginx depends on backend services like PHP-FPM, database services and cache servers to run web applications. We’ve listed the top 5 reasons for 502 Bad Gateway error, and how we fix them. You know something is messed up, because it says “ failed” and “ refused“.īut WHAT? You hardly have time to get a PhD in computer science. So, many web masters roll up their sleeves and look at the error log:Ĥ 08:34:43 949#949: * 7 connect() failed (111: Connection refused) while connecting to upstream, client:, server:, request: "GET /myurl-this/ HTTP/1.0", subrequest: "/redis-fetch", upstream: "redis://127.0.0.1:6379", host: "", referrer: "" 3 word error message – because Nginx doesn’t love you.