欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

nginx下无法打开php,报错[error] 5040#0: 1 connect failed 111: Connection ref

程序员文章站 2022-05-23 22:34:50
...
以下引自stackouverflow-----------------

http://*.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教程有兴趣的朋友有所帮助。