Solve 502 Bad Gateway on Debian 7

When it goes to server, I prefer chose Debian rather than Ubuntu. Compare to Ubuntu, Debian doesn’t consume a lot of resource.

After I installed basic package NGINX + PHP-FPM + MySQL, to make my day easy I installed Phpmyadmin to manage the database. But what I got? I got 502 Bad Gateway?

502 Bad Gateway

502 Bad Gateway


After googling I found that the problem caused by php5-fpm.sock. In the /etc/php5/fpm/pool.d/www.conf code.

To solve that, we just need change

listen = /var/run/php5-fpm.sock


listen =

After that, restart all service,



Moethod 2

Not only that, I figure out another method by reading method 1. If the problem caused by /var/run/php5-fpm.sock. It mean that php listen to that.

to solve this we just change the NGINX virtual host to that

BOOM! The problem is gone!

0 comments… add one

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.