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

WHAT??

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

to

listen = 127.0.0.1:9000

After that, restart all service,

phpMyAdmin

phpMyAdmin

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!

Leave a Reply

Your email address will not be published. Required fields are marked *

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