繁体   English   中英

Nginx + Rails + Unicorn如何避免502 Bad Gateway?

[英]How to avoid 502 Bad Gateway with Nginx + Rails + Unicorn?

我每天都有相同的502错误,但找不到原因。

2014/12/22 16:33:03 [error] 1697#0: *331 upstream prematurely closed connection while reading response header from upstream, client: 105.121.243.92, server: server01.domain.com, request: "GET /doco/in_documents HTTP/1.0", upstream: "http://unix:/tmp/unicorn.docs.sock:/doco/in_documents", host: "go.domain.com:443"
2014/12/22 16:33:05 [error] 1697#0: *331 connect() failed (111: Connection refused) while connecting to upstream, client: 105.121.243.92, server: server01.domain.com, request: "GET /doco/in_documents HTTP/1.0", upstream: "http://10.213.0.46:80/doco/in_documents", host: "go.domain.com:443"
2014/12/22 16:33:09 [error] 1697#0: *334 upstream prematurely closed connection while reading response header from upstream, client: 10.212.255.3, server: server01.domain.com, request: "GET /doco/in_documents HTTP/1.1", upstream: "http://unix:/tmp/unicorn.docs.sock:/doco/in_documents", host: "server01.domain.com"
2014/12/22 16:33:09 [error] 1697#0: *334 connect() failed (111: Connection refused) while connecting to upstream, client: 10.212.255.3, server: server01.domain.com, request: "GET /doco/in_documents HTTP/1.1", upstream: "http://10.213.0.46:80/doco/in_documents", host: "server01.domain.com"
2014/12/22 16:33:15 [info] 1697#0: *333 client closed connection while waiting for request, client: 10.212.255.3, server: 0.0.0.0:80
2014/12/22 16:33:15 [info] 1697#0: *335 client closed connection while waiting for request, client: 10.212.255.3, server: 0.0.0.0:80
2014/12/22 16:33:15 [info] 1697#0: *336 client closed connection while waiting for request, client: 10.212.255.3, server: 0.0.0.0:80
2014/12/22 16:33:15 [info] 1697#0: *338 client closed connection while waiting for request, client: 10.212.255.3, server: 0.0.0.0:80
2014/12/22 16:33:15 [info] 1697#0: *337 client closed connection while waiting for request, client: 10.212.255.3, server: 0.0.0.0:80
2014/12/22 16:33:17 [info] 1697#0: *334 epoll_wait() reported that client prematurely closed connection, so upstream connection is closed too while sending request to upstream, client: 10.212.255.3, server: server01.domain.com, request: "GET /doco/in_documents HTTP/1.1", upstream: "http://unix:/tmp/unicorn.docs.sock:/doco/in_documents", host: "server01.domain.com"
2014/12/22 16:33:19 [info] 1698#0: *343 epoll_wait() reported that client prematurely closed connection, so upstream connection is closed too while sending request to upstream, client: 105.121.243.92, server: server01.domain.com, request: "GET /doco/in_documents HTTP/1.0", upstream: "http://unix:/tmp/unicorn.docs.sock:/doco/in_documents", host: "go.domain.com:443"
2014/12/22 16:33:35 [info] 1698#0: *347 client closed connection while waiting for request, client: 10.212.255.3, server: 0.0.0.0:80
2014/12/22 16:33:35 [info] 1698#0: *346 client closed connection while waiting for request, client: 10.212.255.3, server: 0.0.0.0:80

任何想法如何避免这种情况? 我尝试了与其他问题不同的方法,但是没有效果。

根据您的错误日志和返回的状态(502),可以确定上游服务器没有返回响应。 建议您检查上游配置,地址,端口或其他内容。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM