2014-12-22 128 views
0

我每天都有相同的502错误,但找不到原因。如何使用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 

任何想法如何避免这种情况?我尝试了另一个问题的不同方式,但没有任何效果。

+0

你可以发布你的vhost文件以及你的独角兽配置文件​​吗? – tagCincy

回答

0

根据您的错误日志和返回的状态(502),有一件事是确保您的上游服务器不回应答复。我建议你检查你的上游配置,地址,端口或其他东西。