Blog Details

Linux 作業系統 cutexyz > Blog > 武功秘籍 > 武功秘籍 – HAProxy

武功秘籍 – HAProxy

# ==== Install haproxy ====
apt-get install haproxy

# check the version we install
haproxy -v

# edit the haproxy config  
nano /etc/haproxy/haproxy.cfg

# add these contents to the end of the file.
# add to the end
# define frontend (any name is OK for "http-in") 複製貼上
frontend http-in
        # listen 80 port
        bind *:81
        # set default backend
        default_backend    backend_servers
        # send X-Forwarded-For header
        option             forwardfor

# define backend
backend backend_servers
        # balance with roundrobin
        balance            roundrobin
        # define backend servers
        server             127.0.0.1:80 127.0.0.1:80 check

listen stats
    bind :1936
    stats enable
    stats hide-version
    stats refresh 30s     
    stats show-node
    stats uri  /stats

# check the stats page by visit http://<your_ip>:1936/stats   到網站輸入網址

Leave A Comment

All fields marked with an asterisk (*) are required