Nginx对TCP协议的代理配置

Nginx 1.90 以上版本增加对tcp协议的支持,但需要配置参数开启代理。

 模块参数 --with-stream –-with-stream_ssl_module

  • 具体配置

http的同级添加stream

stream { 
    upstream tigase5280 { 
        hash $remote_addr consistent; 
        server xxx.com:5280 weight=5; 
    } 
    server {
        listen 443 ssl;
        ssl_certificate ssl/cert-.crt;
        ssl_certificate_key  ssl/cert-.key;
        proxy_connect_timeout 10s;
        proxy_timeout 30s;
        proxy_pass tigase5280;  
    }
}
posted @ 2018-11-20 11:10  游园拾忆  阅读(118)  评论(0编辑  收藏  举报