How To Fix 502 Bad Gateway Error on Nginx

September 26, 2016

How To Fix 502 Bad Gateway Error on Nginx? A 502 error, which is most commonly referred to as “Bad Gateway Error” is generally caused due to timeout of PHP request. A gateway is an access point or bridge that establishes a connection between two services.

In order to prevent this error, you need to adjust some server settings i.e. you can increase “Execution Limit” from server settings, by following this article.

How To Fix 502 Bad Gateway Error on Nginx

Method 1. Changes in Nginx Config


Method 2. change PHP-FPM to listen on a unix socket or TCP socket.


If you are configuring php-fpm to listen on a Unix socket, you should also check that the socket file has the correct owner and permissions.


How To Fix 502 Bad Gateway Error on Nginx

Save