nginx做proxy时,出现Cannot assign requested address错误

908 views
Skip to first unread message

朱茂海

unread,
May 13, 2013, 5:31:07 AM5/13/13
to open...@googlegroups.com
现在需要是,所有请求/connect.php文件的,全部反向代理到其它服务器。下面是我写的规则

location =/connect.php
        {
 proxy_set_header       Host            $host;
}

但访问/connect.php时出现502,查看10.134.12.42日志发现如下错误:
2013/05/13 17:27:35 [crit] 10928#0: *101812971 connect() to 10.134.12.42:8082 failed (99: Cannot assign requested address) while connecting to upstream, client: 10.134.12.42, server: xxx, request: "GET /connect.php?mod=login&op=init&referer=forum.php%3Fmod%3Dviewthread%26tid%3D225303&statfrom=login HTTP/1.0", upstream: "http://10.134.12.42:8082/connect.php?mod=login&op=init&referer=forum.php%3Fmod%3Dviewthread%26tid%3D225303&statfrom=login", host: "xxx", referrer: "http://xxxx/forum.php?mod=viewthread&tid=225303"

求解,谢谢各位。

agentzh

unread,
May 13, 2013, 2:31:24 PM5/13/13
to openresty
Hello!

2013/5/13 朱茂海:
> 现在需要是,所有请求/connect.php文件的,全部反向代理到其它服务器。下面是我写的规则
>
> location =/connect.php
> {
> proxy_pass http://10.134.12.42:8082;
> proxy_set_header Host $host;
> }
>
> 但访问/connect.php时出现502,查看10.134.12.42日志发现如下错误:
> 2013/05/13 17:27:35 [crit] 10928#0: *101812971 connect() to
> 10.134.12.42:8082 failed (99: Cannot assign requested address) while
> connecting to upstream,

这里你把你系统中的临时端口用尽了。建议启用 ngx_proxy 模块的 HTTP 1.1 支持和连接池支持。

Best regards,
-agentzh
Reply all
Reply to author
Forward
0 new messages