欢迎光临
我们一直在努力

Nginx使用proxy_bind负载tcp socket,解决代理端口耗尽

http {
    upstream backend {
        server 10.0.0.100:1234;
        server 10.0.0.101:1234;
 }

    server {
        # ...
        location / {
            # ...
            proxy_pass http://backend;
            proxy_bind $split_ip;
            proxy_set_header X-Forwarded-For $remote_addr;
        }
    }

    split_clients "$remote_addr$remote_port" $split_ip {
        10%  10.0.0.210;
        10%  10.0.0.211;
        10%  10.0.0.212;
        10%  10.0.0.213;
        10%  10.0.0.214;
        10%  10.0.0.215;
        10%  10.0.0.216;
        10%  10.0.0.217;
        10%  10.0.0.218;
        *    10.0.0.219;
    }
}

 

https://blog.csdn.net/realmardrid/article/details/111143443

 

 

Overcoming Ephemeral Port Exhaustion in NGINX and NGINX Plus

 

 

赞(0) 打赏
转载请注明来源:IT技术资讯 » Nginx使用proxy_bind负载tcp socket,解决代理端口耗尽

评论 抢沙发

评论前必须登录!

 

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏