Nginx負載均衡SFTP

一、CentOS安裝SFTP,參考php

二、Nginx-1.8.1 下載 ,Nginx_TCP插件 下載 html

三、安裝Nginxnginx

[root@localhost nginx-1.8.1]# yum -y install pcre*
[root@localhost nginx-1.8.1]# yum -y install openssl*
[root@localhost nginx-1.8.1]# patch -p1 < /root/nginx_tcp_proxy_module-master/tcp.patch
[root@localhost nginx-1.8.1]# ./configure --add-module=/root/nginx_tcp_proxy_module-master
[root@localhost nginx-1.8.1]# make
[root@localhost nginx-1.8.1]# make install

四、配置Nginxgit

user  nginx nginx;
worker_processes  4;

events {
worker_connections  512000;
}

tcp {

    upstream sftp{
        server 192.168.208.141:22;
        server 192.168.208.142:22;
        check interval=3000 rise=2 fall=5 timeout=1000;
    }

    server {
        listen 8080;
        proxy_pass sftp;
    }

}

五、添加nginx用戶github

[root@localhost nginx-1.8.1]# useradd nginx

六、啓動Nginxtcp

[root@localhost nginx-1.8.1]# /usr/local/nginx/sbin/nginx

七、關閉防火牆ui

[root@localhost nginx-1.8.1]# service iptables stop

八、winscp鏈接spa

 

參考資料:.net

http://blog.chinaunix.net/xmlrpc.php?r=blog/article&uid=29791971&id=4702007插件

http://www.voidcn.com/blog/anonxiaozi/article/p-5529154.html

https://github.com/yaoweibin/nginx_tcp_proxy_module

相關文章
相關標籤/搜索