1. nginx从1.9.0后引入模块ngx_stream_core_module,模块是没有编译的,需要用到编译需添加--with-stream配置参数

2. 在 nginx.conf 文件中,

与events 和 http 同级:

添加以下配置:

stream {
upstream sockettcp{
#hash $remote_addr consistent;
#server 39.xx.xx.xx:8000;
server 192.xx.xx.xx:8000;
server 39.xx.xx.xx:8000;
}

server{
listen 8000;
proxy_connect_timeout 5s;
proxy_timeout 5s;
proxy_pass sockettcp;
}

}

 

posted on 2018-08-05 16:38  毛会懂  阅读(302)  评论(0编辑  收藏  举报