Answer a question

An nginx/1.0.12 running as a proxy on Debian 6.0.1 starts throwing the following error after running for a short time:

connect() to upstreamip:80 failed (99: Cannot assign requested address) 
while connecting to upstream, client: xxx.xxx.xxx.xxx, server: localhost, 
request: "GET / HTTP/1.1", upstream: "http://upstreamip:80/", 
host: "requesteddomain.com"

Not all requests produce this error, so I suspect that it has to do with the load of the server and some kind of limit it hit.

I have tried raising ulimit -n to 50k and worker_rlimit_nofile to 50k as well, but that does not seem to help. lsof -n shows a total of 1200 lines for nginx. Is there a system limit on outgoing connections that might prevent nginx from opening more connections to its upstream server?

Answers

Seems like I just found the solution to my own question: Allocating more outgoing ports via

echo "10240 65535" > /proc/sys/net/ipv4/ip_local_port_range

solved the problem.

Logo

开发云社区提供前沿行业资讯和优质的学习知识,同时提供优质稳定、价格优惠的云主机、数据库、网络、云储存等云服务产品

更多推荐