Error Nginx 502 [upstream prematurely closed connection]

javdev nginx-forum at nginx.us
Sun Oct 11 21:42:37 UTC 2015


Hello guys this is my first question here.

I'm working on nginx almost 2 years, but in the laste days I have founded an
error, very complicated to solve.

I'm working on Amazon stack, with Elastic Load Balancer (Using TCP (SSL)),
then the request is sent to Nginx (1.8.0), 2 EC2 Instances, each instance
has a Sails project (running on 1337 port).

The connectio is amolst fine, actually sometimes works fine, but after 3 or
5 refresh page, throw the next 502 error:

--- code error ----
2015/10/11 20:14:46 [error] 4623#0: *38 upstream prematurely closed
connection while reading response header from upstream, client:
172.31.35.22, server: , request: "GET
/socket.io/?__sails_io_sdk_version=0.11.0&__sails_io_sdk_platform=browser&__sails_io_sdk_language=javascript&EIO=3&transport=websocket&sid=2Cn2Vmz2ovRgBxWNAAA3
HTTP/1.1", upstream:
"http://127.0.0.1:1337/socket.io/?__sails_io_sdk_version=0.11.0&__sails_io_sdk_platform=browser&__sails_io_sdk_language=javascript&EIO=3&transport=websocket&sid=2Cn2Vmz2ovRgBxWNAAA3",
host: "sails-load-balancer-1968414874.us-west-2.elb.amazonaws.com"
----- End code error----

My configurarion is here:

https://gist.github.com/Ajaxman/6dd5ea772823e45c1a74

And my hostvirtual is here:

https://gist.github.com/Ajaxman/7f98f6c8b92a95e55071

I have tried a lot of suggestions but anything works after 1 week.

Please someone can help me?

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,262108,262108#msg-262108



More information about the nginx mailing list