Nginx connect() failed error

Hazem Hagrass picture Hazem Hagrass · Apr 6, 2013 · Viewed 59.1k times · Source

I don't know why I got this error every time I tried to open the page:

2013/04/06 17:52:19 [error] 5040#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:8080"

Answer

Hazem Hagrass picture Hazem Hagrass · Apr 6, 2013

I resolved it, it was a configuration file issue, I added:

location ~ .php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
}