nginx搭建TCP代理

1、下载https://github.com/yaoweibin/nginx_tcp_proxy_module/archive/master.zip  

2、配置添加nginx_tcp_proxy_module-master 

patch -p1 < /path/to/nginx_tcp_proxy_module/tcp.patch   

./configure --prefix=/usr/local/nginx  --add-module=/home/samba/shb/rtmp/nginx_tcp_proxy_module-master

make 

make install

3、增加配置信息

tcp {  
  
    upstream cluster {  
        # simple round-robin  
        server 127.0.0.1:9091;  
        server 172.0.0.1:9092;  
  
        check interval=3000 rise=2 fall=5 timeout=1000;  
  
        #check interval=3000 rise=2 fall=5 timeout=1000 type=ssl_hello;  
  
        #check interval=3000 rise=2 fall=5 timeout=1000 type=http;  
        #check_http_send "GET / HTTP/1.0\r\n\r\n";  
        #check_http_expect_alive http_2xx http_3xx;  
    }  
  
    server {  
        listen 8888;  
  
        proxy_pass cluster;  
    }  
}  


你可能感兴趣的:(nginx)