Nginx: 502 Bad GateWay
The 502 error appears because nginx cannot hand off to php5-cgi. You can try reconfiguring php5-cgi to use unix sockets as opposed to tcp .. then adjust the server config to point to the socket instead of the tcp ...
ps auxww | grep php5-cgi #-- is the process running?
netstat -an | grep 9000 # is the port open?
I executed my localhost
and the page displayed the 502 bad gateway
message. This helped me:
- Edit
/etc/php5/fpm/pool.d/www.conf
- Change
listen = /var/run/php5-fpm.sock
tolisten = 127.0.0.1:9000
- Ensure the location is set properly in nginx.conf.
- Run
sudo service php5-fpm restart
Maybe it will help you.
Source from: http://wildlyinaccurate.com/solving-502-bad-gateway-with-nginx-php-fpm