nginx新增stream模块负载ftp请求

2020年4月14日 zhangdd 85 0 评论 linux运维

nginx 1.9版本之后直接使用Stream

安装stream模块:

1.nginx 增加tcp ./configure –with-stream (新增配置,其余根据自己需求不变)

2.配置nginx.conf

stream {
upstream ftp {
hash $remote_addr consistent;
server 192.168.1.2:21 max_fails=3 fail_timeout=30s;

server 192.168.1.3:21 max_fails=3 fail_timeout=30s;
}
server {
listen 2121;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass sftp;
}
}

本文声明: 本文出自张佃栋de博客,转载时请注明出处及相应链接。

永久链接: https://zhangdd.com/110.html

最后编辑: 2020/04/14

©著作权归作者所有