首页 > 其他 > 详细

nginx篇高级用法之基于TCP/UDP的四层调度

时间:2019-10-04 09:52:25      阅读:116      评论:0      收藏:0      [点我收藏+]

nginx 从1.9版本开始支持基于TCP/UDP的四层调度,在编译nginx时使用--with-stream开启该模块

支持TCP/UDP调度时,支持给所有的软件做调度器,例如:nfs smb ftp dns 等等...

在编译时:

./configure --with-http_ssl_module --with-stream

开启该模块

准备环境: 为了区分ftp1 和ftp2 他们各自放的共享内容不同

ftp1:192.168.2.100   /var/ftp/password

ftp2:192.168.2.200   /var/ftp/group

proxy:192.168.2.5    nginx

技术分享图片

 

 

在nginx配置文件中进行编辑

events{

}

stream {

  upstream vsftp {
    server 192.168.2.100:21;   //后端服务器IP+代理端口
    server 192.168.2.200:21;
  }
  server {
    listem 21;   //本地监听端口,client访问端口

    proxy_connect_timeout 1s; //连接的超时时间,可选配置

    proxy_timeout 3s;

    proxy_pass vsftp;

  }
}

http{

}

测试结果正确

技术分享图片

 

nginx篇高级用法之基于TCP/UDP的四层调度

原文:https://www.cnblogs.com/lqinghua/p/11621353.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!