Skip to content

Instantly share code, notes, and snippets.

@monkeym4ster
Last active July 20, 2020 09:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save monkeym4ster/0a8c4b955330478c1f1811794df91bae to your computer and use it in GitHub Desktop.
Save monkeym4ster/0a8c4b955330478c1f1811794df91bae to your computer and use it in GitHub Desktop.
Use haproxy to proxy shadowsocks

Install haproxy

apt-get install haproxy 

Config haproxy

Edit /etc/haproxy/haproxy.cfg like this(You need to replace IP and port):

global
        ulimit-n 51200
        pidfile /var/run/haproxy.pid

defaults
        log global
        mode tcp
        option dontlognull
        contimeout 10000
        clitimeout 150000
        srvtimeout 150000

frontend ss-in
        bind *:LOCAL_LISTEN_PORT // Local bind port
        default_backend ss-out

backend ss-out
        server server1 SS_SERVER_IP:SS_SERVER_PORT maxconn 20480

Start

Manual

haproxy -f /etc/haproxy/haproxy.cfg

Auto start

Edit config file: /etc/default/haproxy

ENABLED=1

service haproxy start

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment