nginx四层转发_nginx配置ftp反向代理

#nginx转发控制线路

server {

#nginx代理端口

listen 21212;

proxy_timeout 120s;

proxy_connect_timeout 120s;

proxy_pass fx_ftp;

}

upstream fx_ftp{

hash $remote_addr consistent;

#后端ftp服务ip+端口

server ftp_ip:端口 max_fails=3 fail_timeout=30s;

}

#被动数据转发

server {

#被动端口

listen 10006;

proxy_timeout 120s;

proxy_connect_timeout 120s;

proxy_pass pasvdata;

}

upstream pasvdata{

hash $remote_addr consistent;

server ftp_ip:被动端口1;

server ftp_ip:被动端口2;

server ftp_ip:被动端口3;

server ftp_ip:被动端口4;

server ftp_ip:被动端口5;

}