[error] 13169#0: *7 connect() failed (111: Connection refused) while connecting to upstream, client: XXX.XXX.XXX.XXX, server: test.local, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "test.local"
When setting up nginx to work with php-fpm on ubuntu 14.04, this happened when I was using some config templates from a bit older server. It seems to result from nginx being configured to listen with a socket connection versus TCP, and the virtual host being configured to listen with TCP. The fix was somewhat intuitive, but I never would have thought to look in
The fix for me: In
listen = /var/run/php5-fpm.sock
listen = 127.0.0.1:9000
This should match the php line in your
/etc/nginx/sites-enabled/WHATEVERCONFIG. Mine uses TCP with the line
as opposed to