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

来源:互联网 发布:淘宝买兔子炒了 编辑:程序博客网 时间:2024/06/06 01:16
以下引自stackouverflow-----------------
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
0 0
原创粉丝点击