haproxy
high-performance TCP/HTTP load balancer and proxy
TLDR
SYNOPSIS
haproxy [options] -f config
DESCRIPTION
HAProxy (High Availability Proxy) is a high-performance TCP/HTTP load balancer and reverse proxy that distributes incoming traffic across pools of backend servers. Its configuration is organized around frontends (which accept client connections on bound addresses and ports) and backends (which define the set of servers that handle requests, along with the balancing algorithm -- round-robin, least-connections, source-hash, and others). Active health checks continuously probe backend servers and automatically remove unhealthy nodes from rotation.Beyond basic load balancing, HAProxy provides SSL/TLS termination, HTTP header manipulation, content-based routing via ACLs, connection rate limiting, stick tables for session persistence, and a real-time statistics dashboard. It operates on an event-driven, multi-threaded worker model that can handle hundreds of thousands of concurrent connections with low latency and minimal resource consumption, making it a standard choice for high-traffic production environments.Modern deployments typically run it in master-worker mode (-W/-Ws), where a master process supervises one or more worker processes and can reload the configuration or reload binaries without dropping established connections.
PARAMETERS
-f file
Configuration file.-c
Check configuration and exit.-D
Daemon mode.-sf pids
Soft-stop old processes.-st pids
Hard-stop old processes.-p pidfile
PID file path.-n maxconn
Maximum connections.-N maxconn
Default per-proxy maxconn.-d
Debug mode; disables daemon mode and stays in the foreground.-V
Verbose mode (cancels -q).-q
Quiet mode; suppresses informational messages.-v
Display version and build date.-W
Master-worker mode: a master process supervises worker process(es) and reloads configuration without dropping connections.-Ws
Master-worker mode with systemd `sd_notify` support; used by the official systemd unit.-x socket
Retrieve listening sockets from an old process (used internally for seamless reloads).-C dir
Change to this directory before loading configuration files.
CONFIG EXAMPLE
bind *:80
default_backend http_back
backend http_back
balance roundrobin
server web1 192.168.1.1:80 check
server web2 192.168.1.2:80 check
INSTALL
CAVEATS
Configuration changes require reload. Complex ACLs need careful testing. Statistics require separate configuration. SSL setup needs certificate management.
HISTORY
HAProxy was created by Willy Tarreau in 2000 and has become one of the most widely deployed load balancers. It powers high-traffic sites including GitHub, Reddit, and Stack Overflow.
