使用Haproxy进行端口转发
首先安装HAProxy
Centos使用
yum install haproxy -yDebian使用
vi /etc/apt/sources.list添加如下内容
deb http://ftp.us.debian.org/debian/ wheezy-backports main然后
apt-get update apt-get install haproxy接下来设置配置文件
vi /etc/haproxy/haproxy.cfg清空配置文件后,输入如下内容
global
        ulimit-n  51200
defaults
        log global
        mode    tcp
        option  dontlognull
        timeout connect 1000
        timeout client 150000
        timeout server 150000
frontend ss-in
        bind *:8388
        default_backend ss-out
backend ss-out
        server server1 VPS_IP:8388 maxconn 20480如果需要多服务器轮询的可以在backend里多建几个server轮询
运行Haproxy
haproxy -f /etc/haproxy/haproxy.cfg