nginx tcp代理

来源:互联网 发布:保湿乳液推荐 知乎 编辑:程序博客网 时间:2024/06/05 04:51
nginx1.7.7之前不支持tcp代理,使用tcp代理需安装nginx_tcp_proxy_module,
参考:http://blog.csdn.net/aspnet_lyc/article/details/52267175
nginx 1.7.7后开始支持tcp代理,nginx 1.9.13后添加了udp代理的支持.


如果需要用到这个功能,就需要加上 --with-stream 参数重新编译nginx


重新编译nginx, 并加上--with-stream 参数
通过平滑升级的方式启动nginx 参考:http://blog.csdn.net/aspnet_lyc/article/details/52266875


配置和http一样,简单明了


stream {upstream backend {#hash $remote_addr consistent;#server backend1.example.com:12345 weight=5;#server unix:/tmp/backend3;server 192.168.0.2:22 max_fails=3 fail_timeout=30s;server 192.168.0.3:22 max_fails=3 fail_timeout=30s;}server {listen 9998;proxy_connect_timeout 1s;proxy_timeout 3s;proxy_pass backend;}}



0 0
原创粉丝点击