时间:2021-07-01 10:21:17 帮助过:3人阅读
http://stackoverflow.com/questions/15852884/nginx-connect-failed-error
报错信息如下:
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" 解决办法: | |
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;
}
原因:
There are some situations when fastcgi_pass 127.0.0.1:9000; is present in server block and is responsible for this error, in such cases you need change it to fastcgi_pass unix:/var/run/php5-fpm.sock;. – Kamil Zieliński Dec 8 '13 at 10:34
This is because php5-fpm now ships with the Unix socket listen = /var/run/php5-fpm.sockenabled in /etc/php5/fpm/pool.d/www.conf instead of the TCP socket listen = 127.0.0.1:9000. This is typically a little faster. (For google search purposes) ubuntu 14.04 nginx php5-fpm 502 Bad Gateway. I have a feeling a lot of people will be needing this in the near future. There are so many tutorials with the old socket in place. – DutGRIFF May 9 at 6:09
以上就介绍了 nginx下无法打开php,报错[error] 5040#0: 1 connect failed 111: Connection ref ,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。