nginx:连接到上游时,connect()失败(111:连接被拒绝) [英] nginx: connect() failed (111: Connection refused) while connecting to upstream

查看:3163
本文介绍了nginx:连接到上游时,connect()失败(111:连接被拒绝)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试部署我的第一个门户.

Trying to deploy my first portal .

通过浏览器发送请求时,我在浏览器中收到502网关超时错误

I am getting 502 gateway timeout error in browser when i was sending the request through browser

当我检查日志时,出现此错误

when i checked the logs , i got this error

 2014/02/03 09:00:32 [error] 16607#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 14.159.131.19, server: foo.com, request: "GET HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "22.11.180.154"

是否存在与权限相关的问题

is there any problem related to permissions

推荐答案

我认为该解决方案无论如何都不会奏效,因为您会在错误日志文件中看到一些错误消息.

I don't think that solution would work anyways because you will see some error message in your error log file.

解决方案比我想象的要容易得多.

The solution was a lot easier than what I thought.

简单地,打开以下路径到您的php5-fpm

simply, open the following path to your php5-fpm

sudo nano /etc/php5/fpm/pool.d/www.conf

或者如果您是管理员"root"

or if you're the admin 'root'

nano /etc/php5/fpm/pool.d/www.conf

然后找到此行并取消注释:

Then find this line and uncomment it:

listen.allowed_clients = 127.0.0.1

该解决方案将使您能够在虚拟主机块中使用 listen = 127.0.0.1:9000

This solution will make you be able to use listen = 127.0.0.1:9000 in your vhost blocks

像这样: fastcgi_pass 127.0.0.1:9000;

进行修改后,您只需重启或重新加载Nginx和Php5-fpm

after you make the modifications, all you need is to restart or reload both Nginx and Php5-fpm

Php5-fpm

sudo service php5-fpm restart

sudo service php5-fpm reload

Nginx

sudo service nginx restart

sudo service nginx reload

从评论中:

也可以评论

;listen = /var/run/php5-fpm.sock 

并添加

listen = 9000

这篇关于nginx:连接到上游时,connect()失败(111:连接被拒绝)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆