HAproxy

通过国内高质量线路 VPS 上搭建 HAproxy 服务中转

CentOS7

https://www.softwarecollections.org/en/scls/rhscl/rh-haproxy18/

yum install -y centos-release-scl && yum install -y rh-haproxy18

scl enable rh-haproxy18 bash

mv -iv /etc/opt/rh/rh-haproxy18/haproxy/haproxy.cfg{,.ori}

配置文件实例:

# cat /etc/opt/rh/rh-haproxy18/haproxy/haproxy.cfg

global
        ulimit-n        51200
defaults
        log             global
        mode            tcp
        option          dontlognull
        timeout         connect 5000
        timeout         client  50000
        timeout         server  50000
frontend ss-inside
        bind            *:9090
        default_backend ss-outside
backend ss-outside
        server ss-server 45.67.89.10:9090 maxconn 30720

# systemctl start rh-haproxy18-haproxy

# netstat -lntp|grep -i haproxy
tcp       0     0 0.0.0.0:9090    0.0.0.0:*    LISTEN   359/haproxy

# systemctl enable rh-haproxy18-haproxy
Created symlink from /etc/systemd/system/multi-user.target.wants/rh-haproxy18-haproxy.service
to /usr/lib/systemd/system/rh-haproxy18-haproxy.service.

kernel BBR module

国内中转机也需要启用 BBR 内核模块,提高接入客户端的下载速率:

echo -e "net.core.default_qdisc=fq\nnet.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p

reference

用 Haproxy 给你的 SS 加个前端 2016-02-18

SSR + 跳板搭建记录 2018-01-03

使用 HAProxy 搭建 Shadowsocks 跳板 #5 2019-03-06