nginx配置stream模块
使用背景使用stream模块转发应用服务器sftp连接请求。1.解压nginx压缩包tar -zxvf nginx-1.28.3.tar.gz2.指定配置项--prefix表示安装路径--with-stream表示添加流模块./configure --prefix/home/app/nginx/nginx1.28.3 --with-stream --with-http_stub_status_module --add-module/home/app/nginx/nginx-module-vts-0.2.5 --with-http_ssl_module --with-http_v2_module--with-stream 流式请求如ftp--with-http_stub_status_module nginx状态监控--with-nginx-module-vts 监控加强如上游upstream第三方包需要先下载--with-http_ssl_module 支持https--with-http_v2_module 支持http23.编译make4.安装make install5.添加流模块,与http模块同级stream {upstream sftp_zj {hash $remote_addr consistent;server hz-sftp1.zj.com:2122 max_fails3 fail_timeout60s;#sftp服务器和端口}#sftp代理server {listen 2122;proxy_connect_timeout 10s;proxy_timeout 10s;proxy_pass sftp_zj;}}6.启动nginx./nginx -c /home/app/nginx/nginx1.28.3/conf/nginx.conf7.完成后可删除压缩包和源文件