使用haproxy实现shadowsocks 国内中转加速

转帖自:https://smileawei.com/shadowsocks-haproxy/

由于晚上高峰时段,电信国际出口缓慢;

为了加快速度,根据shadowsocks的github页面的介绍,使用haproxy对ss做中转。

环境为阿里云ECS ,debian7.5

先添加apt源

vi  /etc/apt/sources.list

然后添加源

deb http://ftp.us.debian.org/debian/ wheezy-backports main

保存后

apt-get update

然后安装haproxy

apt-get install haproxy

centos下请先yum update -y再yum install haproxy -y

编辑haproxy配置文件

vi /etc/haproxy/haproxy.cfg

清空后像下面一样写入配置

global
ulimit-n  51200

defaults
log global
mode    tcp
option  dontlognull
timeout connect 1000ms
timeout client 150000ms
timeout server 150000ms

frontend 110-in
bind *:110
default_backend 110-out

frontend 109-in
bind *:109
default_backend 109-out
frontend 110-in-jp
bind *:1110
default_backend 110-out-jp
backend 110-out
server server1 spg.xx.xx:110 maxconn 20480

backend 109-out
server server1 spg.xx.xx:109 maxconn 20480

backend 110-out-jp
server server1 jp.xx.xx:110 maxconn 20480

 

可以配置多端口。

frontend的端口为要在中转服务器上用的端口

backend的端口是源服务器的ip和端口

每个端口的“frontend” 要对应一个“backend”

文件写的时候要记得一一对应。

运行命令:

haproxy -f /etc/haproxy/haproxy.cfg

我用的阿里云做的中转,速度明显提升。

不过阿里云的流量是真贵。

 

p.s. 参考:https://github.com/shadowsocks/shadowsocks/wiki/Setup-a-Shadowsocks-relay

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

返回主页看更多
狠狠的抽打博主 支付宝 扫一扫