要求nginx版本大于1.9,
在nginx.conf添加以下,要求和http{}同级
stream {
upstream cakehouse {
server 172.17.210.101: weight= max_fails= fail_timeout=30s ;
}
server {
listen ;
proxy_connect_timeout 10s;
proxy_timeout 5s;
proxy_pass cakehouse;
}
}
前提编译时需要加载--with-stream模块
# ./configure --with-stream