HAProxy is a proven TCP and HTTP load balancer known for efficiency, detailed health checks and rich observability. On a Hong Kong VPS it distributes traffic across application servers, terminates TLS and shields backends from bursts.
Step 1: Install
apt install -y haproxy
haproxy -v
Step 2: Configuration
# /etc/haproxy/haproxy.cfg
global
log /dev/log local0
maxconn 20000
ssl-default-bind-options ssl-min-ver TLSv1.2
defaults
mode http
log global
option httplog
option forwardfor
timeout connect 5s
timeout client 30s
timeout server 30s
frontend https_in
bind :443 ssl crt /etc/haproxy/certs/example.com.pem alpn h2,http/1.1
bind :80
http-request redirect scheme https unless { ssl_fc }
# simple per-IP rate limit: 100 requests / 10s
stick-table type ip size 200k expire 10m store http_req_rate(10s)
http-request track-sc0 src
http-request deny deny_status 429 if { sc_http_req_rate(0) gt 100 }
acl is_api path_beg /api
use_backend api_servers if is_api
default_backend web_servers
backend web_servers
balance roundrobin
option httpchk GET /health
http-check expect status 200
server web1 10.0.0.11:3000 check inter 3s fall 3 rise 2
server web2 10.0.0.12:3000 check inter 3s fall 3 rise 2
backend api_servers
balance leastconn
option httpchk GET /health
server api1 10.0.0.21:4000 check
server api2 10.0.0.22:4000 check backup
listen stats
bind 127.0.0.1:8404
stats enable
stats uri /stats
stats refresh 5s
Step 3: Certificate and Reload
cat /etc/letsencrypt/live/example.com/fullchain.pem /etc/letsencrypt/live/example.com/privkey.pem > /etc/haproxy/certs/example.com.pem
haproxy -c -f /etc/haproxy/haproxy.cfg && systemctl reload haproxy
Step 4: Avoid a Single Point of Failure
One load balancer is itself a single point of failure. Run two HAProxy nodes with Keepalived and a floating IP where your provider supports it, or use DNS failover with health checks.
Conclusion
HAProxy on a Hong Kong VPS adds resilience, health-based routing and rate limiting in front of your application tier, and it handles very high connection counts on modest hardware.
Balance your traffic: Browse Server.HK Hong Kong VPS plans.
Related articles
Caddy Server on Hong Kong VPS: Automatic HTTPS Reverse Proxy (2026)Nov 18, 2026AdGuard Home on Hong Kong VPS: Private DNS with Ad Blocking (2026)Nov 17, 2026PocketBase on Hong Kong VPS: Single-Binary Backend (2026)Nov 16, 2026Self-Hosted Appwrite on Hong Kong VPS: Open-Source Backend (2026)Nov 15, 2026