nginx使用ngx_stream_core_module模块代理tcp长连接短连接,可以增强服务器的容灾能力

下面是一个配置信息,自己也方便记录一下

nginx 代理tcp长连接短连接配置_服务器

 

 

  1. tcp {  
  2.     timeout 1d;  
  3.     proxy_read_timeout 10d;  
  4.     proxy_send_timeout 10d;  
  5.     proxy_connect_timeout 30;  
  6.   
  7.     upstream tcpend {  
  8.         server 192.168.1.55:7778;  
  9.         server 192.168.1.58:7778;  
  10.         check interval=60000 rise=2 fall=5 timeout=10000 type=tcp;  
  11.     }  
  12.   
  13.     server {  
  14.         server_name  192.168.1.56;  
  15.         listen 192.168.1.56:7777;  
  16.         proxy_pass tcpend;  
  17.         so_keepalive on;  
  18.         tcp_nodelay on;  
  19.     }  
  20. }