Invalid fastcgi_pass settings inside 000-apps.vhost
On a new installation of ISPConfig 126.96.36.199 running Debian 6.0.6 with Nginx and PHP 5.4.11, I was getting a 502 Bad Gateway when trying to visit www.example.com:8081/phpmyadmin or www.example.com:8081/squirrelmail. So I first tried the normal "service restart php5-fpm" and it had no change. I then looked inside /var/log/nginx/error.log and this is what I found:
2013/01/27 03:46:53 [error] 32318#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 9X.2XX.1XX.9X, server: _, request: "GET /squirrelmail/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.example.com:8081"
So I looked inside the /etc/nginx/sites-enabled/000-apps.vhost file at the blocks for phpmyadmin and squirrelmail and they were setting the fastcgi_pass to use a TCP/IP port instead of using the apps.sock unix socket.
Obvious FIX was to change the "fastcgi_pass 127.0.0.1:9000;" to use the apps.sock unix socket inside the phpmyadmin and squirrelmail location blocks. Like this:
Change this: fastcgi_pass 127.0.0.1:9000;
To: #fastcgi_pass 127.0.0.1:9000; fastcgi_pass unix:/var/lib/php5-fpm/apps.sock;