502 Bad Gateway When We Send Notification

Hi, When ever we send notification to our users, Server send 502 Bad Gateway, It may be due to high traffic at that time. It give 502 Bad Gateway for around 2-3 minutes after that it start behaving normally. I checked server log it shows :

2017/10/12 09:15:10 [error] 14061#14061: *34962277 connect() to unix:/var/run/php/php7.0-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 106.205.134.145, server: topcoaching.in, request: "GET /api/….. HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "topcoaching.in"

I have try to solve the problem but not get any success. It will be good for me if you can suggest any solution for this problem. I have also upgrade Linode but again it stop working when send notification to users.

1 Reply

Hi there,

I can understand how frustrating experience that would be and I will try my level best to get you pointed in the right direction.

As per my research, what I have found out is that the HyperText Transfer Protocol (HTTP) 502 Bad Gateway server error response code usually suggests a service that the web server needs but cannot connect to or find. This error deals with the internal configuration of your server.

Since you're using PHP-FPM which is often deployed behind an Nginx webserver, Nginx will return a 502 Bad Gateway error if it can’t successfully proxy a request to PHP-FPM, or if PHP-FPM fails to respond.

The error that you have shared from error log (/var/log/nginx/error.log) seems to be that the socket doesn’t exist, possibly because PHP-FPM isn’t running. Below I am attaching a link for your reference that will help you in troubleshooting with why "PHP-FPM isn’t running" and "NGINX can’t access the socket". These two sections in this link can help fix your problem:

I hope that helps!Please let us know if you any other questions for us.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct