upstream prematurely closed connection while reading response header from upstream, client

ぃ、小莉子 提交于 2019-12-12 11:26:20

问题


I'm getting this error from /var/log/messages on my FreeBSD box. I'm using nginx and spawn-fcgi with memcache and apc modules enabled.

upstream prematurely closed connection while reading response header from upstream, 
client HTTP/1.1", upstream: "fastcgi://unix:/tmp/fcgi.sock:", host:

回答1:


I've had a similar error with unicorn + nginx.

The end result was that the unicorn was timing out due to a firewall misconfiguration, dieing off and leaving NGINX clueless as to what to do (nginx would then throw a 503).

Once the port was open my issue was resolved.

I've also seen this happen with an API call that takes a long time (longer than my 30s unicorn timeout). I ended up shipping it off to a background job so the unicorn didn't timeout.




回答2:


I had a similar issue with Nginx timing out with a RoR app when using an EC2 + Amazon RDS database instance.

The issue was resolved by editing my security group for the RDS instance to allow the EC2's IP over port 5432. Just edit the security group's rules to add a custom rule for the port you are communicating to the RDS instance over, and whitelist the EC2 server's private IP address. Worked instantly after that!




回答3:


It was related to the version of PHP. I have used latest version of nginx and slightly old version of PHP. The issue has been fixed by updating PHP to latest version.



来源:https://stackoverflow.com/questions/14193954/upstream-prematurely-closed-connection-while-reading-response-header-from-upstre

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!