歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> nginx tcp proxy 連接保持設置

nginx tcp proxy 連接保持設置

日期:2017/3/1 14:47:43   编辑:關於Linux
根據前文Nginx tcp proxy module試用的設置,在測試環境中發現tcp連接經常掉線。在該項目站點上找到一個issue,也談論這件事情,不過別人用在web socket協議上。 其實就是少了幾個設置,README的配置不能用於生產環境。 我的配置如下,現在工作正常了:
tcp {  
    timeout 1d;  
    proxy_read_timeout 10d;  
    proxy_send_timeout 10d;  
    proxy_connect_timeout 30;  
  
    upstream tcpend {  
        server 192.168.1.55:7778;  
        server 192.168.1.58:7778;  
        check interval=60000 rise=2 fall=5 timeout=10000 type=tcp;  
    }  
  
    server {  
        server_name  192.168.1.56;  
        listen 192.168.1.56:7777;  
        proxy_pass tcpend;  
        so_keepalive on;  
        tcp_nodelay on;  
    }  
}  


Copyright © Linux教程網 All Rights Reserved