1.安装好nginx后,在根目录下增加 stream 模块,执行:
- ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-stream
- 执行make进行编译
- 执行make install 进行安装
- 执行./nginx -v 查看是否安装成功
2.配置nginx
stream{
upstream tcp1{
server xxx:1234;
}
server{
listen 1234;
proxy_connect_timeout 20s;
proxy_timeout 5m;
proxy_pass tcp1;
}
}