A comprehensive guide to installing and configuring SSL certificates on HAProxy load balancers.
Before installing an SSL certificate on HAProxy, ensure you have:
You can obtain an SSL certificate through several methods:
Follow these steps to prepare your SSL certificate:
sudo mkdir -p /etc/haproxy/certs
cat example.com.crt example.com.key > /etc/haproxy/certs/example.com.pem
sudo chown -R haproxy:haproxy /etc/haproxy/certs
sudo chmod 600 /etc/haproxy/certs/example.com.pem
Use our configuration generator to create your HAProxy SSL configuration:
global
ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384
ssl-default-bind-options no-sslv3 no-tlsv10 no-tlsv11
frontend https-in
bind *:443 ssl crt /etc/haproxy/certs/example.com.pem
mode http
option forwardfor
default_backend web-backend
backend web-backend
mode http
balance roundrobin
server web1 192.168.1.10:80 check
server web2 192.168.1.11:80 check
Verify your SSL configuration:
haproxy -c -f /etc/haproxy/haproxy.cfg
sudo systemctl restart haproxy
HAProxy SSL termination features:
# Example SNI Configuration
frontend https-in
bind *:443 ssl crt-list /etc/haproxy/crt-list.txt
use_backend %[ssl_fc_sni,lower]
Certellix is an independent service. We are not affiliated with any commercial certificate authority.