How to config HAProxy and LetsEncrypt SSL Certificates - Tue, Jun 29, 2021
HAProxy is a free solution for load balancing and proxying. Learn how to integrate the LetsEncrypt free SSL certificates.
HAProxy is a free solution for load balancing and proxying. Learn how to integrate the LetsEncrypt free SSL certificates with 3 steps.
First, generate your SSL with certbot or any tool you want, we will need the *.pem files.
Second and most important, you need to combine the certificates into a single file using the next command:
cat private_organization.com.pem fullchain_organization.com.pem > organization.com.pem
Third, update your HAProxy config to include the certificates
nano /opt/haproxy/etc/haproxy.cfg
# add the next line to your frontend
bind *:443 ssl crt /opt/haproxy/etc/certificates/organization.com.pem
# also allows multiple certificates using
bind *:443 ssl crt /opt/haproxy/etc/certificates/organization.com.pem crt /opt/haproxy/etc/certificates/organization2.com.pem crt /opt/haproxy/etc/certificates/organization3.com.pem
Troubleshooting
How to kill the haproxy process
# Find the haproxy process ID
ps -aux | grep haproxy
# Kill the process
kill -9 ID
# Start haproxy again
/opt/haproxy/sbin/haproxy -f /opt/haproxy/etc/haproxy.cfg