HAProxy – High Availability Load Balancer

HAProxy is a free, fast, and reliable reverse proxy offering high availability, load balancing, and...

Networking Tools Linux Open Source

HAProxy is a free, fast, and reliable reverse proxy offering high availability, load balancing, and proxying for TCP and HTTP-based applications. It is the de-facto standard open-source load balancer, deployed at scale by major companies including GitHub, Stack Overflow, and Twitter. HAProxy is particularly suited for high-traffic websites requiring exceptional performance and reliability.

Key Features

  • Load Balancing – Multiple algorithms: round-robin, leastconn, source
  • SSL/TLS Termination – Offload encryption from backend servers
  • Health Checks – Active and passive server monitoring
  • Stick Tables – Session persistence and rate limiting
  • ACLs – Powerful request routing and filtering
  • Stats Dashboard – Real-time monitoring interface

Installation

# Debian/Ubuntu
sudo apt install haproxy

# RHEL/CentOS/Fedora
sudo dnf install haproxy

# Arch Linux
sudo pacman -S haproxy

Basic Configuration

# /etc/haproxy/haproxy.cfg
global
    log /dev/log local0
    maxconn 4096
    user haproxy
    group haproxy

defaults
    log global
    mode http
    timeout connect 5s
    timeout client 50s
    timeout server 50s

frontend http_front
    bind *:80
    default_backend http_back

backend http_back
    balance roundrobin
    server web1 192.168.1.10:80 check
    server web2 192.168.1.11:80 check
    server web3 192.168.1.12:80 check

listen stats
    bind *:8404
    stats enable
    stats uri /stats

Use Cases

HAProxy excels at web application load balancing, API gateway deployment, database connection pooling, microservices routing, and high-availability configurations.

Download HAProxy

Was this article helpful?