バックエンドホストの状態を監視しながらnginxのTCPのnginx_tcp_proxy_module機能は、エージェントモジュールによって提供されます。ngx_tcp_module、ngx_tcp_core_module、ngx_tcp_upstream_module、ngx_tcp_proxy_module、ngx_tcp_upstream_ip_hash_module:モジュールは、モジュールが含まれています。1.インストール
# wget http://nginx.org/download/nginx-1.4.4.tar.gz
# tar zxvf nginx-1.4.4.tar.gz
# cd nginx-1.4.4
# ./configure --add-module=/path/to/nginx_tcp_proxy_module
# make
# make install
2. [設定
http {
listen 80;
location /status {
check_status;
}
}
tcp {
upstream cluster_www_ttlsa_com {
# simple round-robin
server 127.0.0.1:1234;
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_www_ttlsa_com;
}
}
これは問題になり、TCP接続が切断されますされています。その理由は、nginxのは、サーバに近いリンクとみなさルールの実装では、その後、nginxのは、クライアントへの接続を閉じますとき、チェックするまで待つ必要がある、サーバーが接続を閉じたときに、すぐに接続を見つけることができなかったクライアントが閉じられたことです。3.接続設定をしてください
http {
listen 80;
location /status {
check_status;
}
}
tcp {
timeout 1d;
proxy_read_timeout 10d;
proxy_send_timeout 10d;
proxy_connect_timeout 30;
upstream cluster_www_ttlsa_com {
# simple round-robin
server 127.0.0.1:1234;
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_www_ttlsa_com;
so_keepalive on;
tcp_nodelay on;
}
}
具体nginx_tcp_proxy_moduleモジュールコマンドを参照:http://yaoweibin.github.io/nginx_tcp_proxy_module/README.html
ます。https://my.oschina.net/766/blog/211182で再現