LinuxCommandLibrary

haproxy

TLDR

Start HAProxy

$ haproxy -f [/etc/haproxy/haproxy.cfg]
copy
Check configuration
$ haproxy -c -f [/etc/haproxy/haproxy.cfg]
copy
Reload configuration
$ haproxy -f [config.cfg] -sf $(pidof haproxy)
copy
Start in daemon mode
$ haproxy -D -f [config.cfg]
copy
Show version
$ haproxy -v
copy

SYNOPSIS

haproxy [options] -f config

DESCRIPTION

HAProxy is a high-performance TCP/HTTP load balancer and proxy. It distributes traffic across multiple servers, providing high availability, health checking, and SSL termination.
HAProxy is widely used in production environments for its reliability, performance, and extensive feature set including ACLs, rate limiting, and detailed statistics.

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.
-V
Verbose mode.

CONFIG EXAMPLE

$ frontend http_front
    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
copy

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.

SEE ALSO

nginx(1), envoy(1), traefik(1)

Copied to clipboard