Nginx对TCP协议的代理配置
2018-11-20 本文已影响7人
游园拾忆
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;
}
}