This container contains an HAProxy server with an auto Letsencrypt renewal service.
- Docker Compose
docker pull tinganho/haproxy-with-letsencrypt-auto-renewal
Create a HAProxy configuration file in /etc/haproxy/haproxy.cfg
. And add at least the following entries:
global
tune.ssl.default-dh-param 2048
frontend http
bind *:80
reqadd X-Forwarded-Proto:\ http
acl letsencrypt-acl path_beg /.well-known/acme-challenge/
redirect scheme https if !letsencrypt-acl
default_backend letsencrypt-backend
frontend https
bind *:443 ssl crt /usr/local/etc/haproxy/certs/domain.com.pem
backend letsencrypt-backend
server letsencrypt 127.0.0.1:54321
In your docker-compose.yml
file add the following service:
haproxy:
image: tinganho/haproxy-with-letsencrypt-auto-renewal
ports:
- 80:80
- 443:443
environment:
# Comma separated list of domains. The root domain must be the first entry.
DOMAINS: domain.com, sub.domain.com
EMAIL: [email protected]
volumes:
- /etc/haproxy:/usr/local/etc/haproxy
- /var/log/haproxy:/var/log/haproxy