使用背景:使用stream模块转发应用服务器sftp连接请求。
1.解压nginx压缩包
tar -zxvf nginx-1.16.1.tar.gz
2.指定配置项,–prefix表示安装路径,–with–stream表示添加流模块
./configure —prefix=/usr/local/nginx–my–stream/nginx1.16 –with–stream –with-http_stub_status_module –with-http_ssl_module
5.添加流模块,与http模块同级
stream {
upstream sftp_zj {
hash $remote_addr consistent;
server hz-sftp1.zj.com:2122 max_fails=3 fail_timeout=60s;
#sftp服务器和端口
}
#sftp代理
server {
listen 2122;
proxy_connect_timeout 10s;
proxy_timeout 10s;
proxy_pass sftp_zj;
}
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。