docs: add ACME DNS-01 and HTTP-01 switching guide
This commit is contained in:
84
TRAEFIK-ACME-CHALLENGE-SWITCHING.md
Normal file
84
TRAEFIK-ACME-CHALLENGE-SWITCHING.md
Normal file
@@ -0,0 +1,84 @@
|
||||
# Traefik ACME Challenge Switching Guide
|
||||
|
||||
This guide explains how to switch SSL certificate issuance in this stack between DNS-01 and HTTP-01 challenge types.
|
||||
|
||||
## When to use each challenge
|
||||
|
||||
- Use DNS-01 if Let’s Encrypt cannot reach your server from the internet.
|
||||
- Use HTTP-01 if port 80 on your public domains is reachable by Let’s Encrypt.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- The stack is configured with Traefik and ACME enabled.
|
||||
- You are editing the environment file used by Docker Compose, usually .env.
|
||||
|
||||
## Switch to DNS-01 (Cloudflare)
|
||||
|
||||
1. Edit your .env and set:
|
||||
|
||||
```env
|
||||
TRAEFIK_SERVICES_TLS_CONFIG=tls.certresolver=letsencrypt
|
||||
TRAEFIK_ACME_MAIL=devops@example.com
|
||||
TRAEFIK_ACME_CHALLENGE=dns
|
||||
TRAEFIK_ACME_DNS_PROVIDER=cloudflare
|
||||
CF_DNS_API_TOKEN=your-cloudflare-api-token
|
||||
# Optional for split-DNS or propagation issues:
|
||||
# TRAEFIK_ACME_DNS_RESOLVERS=1.1.1.1:53,8.8.8.8:53
|
||||
```
|
||||
|
||||
2. Restart Traefik:
|
||||
|
||||
```bash
|
||||
docker compose up -d traefik
|
||||
```
|
||||
|
||||
3. Verify challenge mode in logs:
|
||||
|
||||
```bash
|
||||
docker compose logs -f traefik
|
||||
```
|
||||
|
||||
Look for log output indicating ACME DNS challenge usage.
|
||||
|
||||
## Switch to HTTP-01
|
||||
|
||||
1. Edit your .env and set:
|
||||
|
||||
```env
|
||||
TRAEFIK_SERVICES_TLS_CONFIG=tls.certresolver=letsencrypt
|
||||
TRAEFIK_ACME_MAIL=devops@example.com
|
||||
TRAEFIK_ACME_CHALLENGE=http
|
||||
TRAEFIK_ACME_DNS_PROVIDER=cloudflare
|
||||
CF_DNS_API_TOKEN=
|
||||
```
|
||||
|
||||
2. Ensure public inbound access from Let’s Encrypt to port 80 on each domain.
|
||||
|
||||
3. Restart Traefik:
|
||||
|
||||
```bash
|
||||
docker compose up -d traefik
|
||||
```
|
||||
|
||||
4. Check Traefik logs for HTTP challenge activity:
|
||||
|
||||
```bash
|
||||
docker compose logs -f traefik
|
||||
```
|
||||
|
||||
## Common issues
|
||||
|
||||
- DNS-01 fails with Cloudflare:
|
||||
- Verify CF_DNS_API_TOKEN is set.
|
||||
- Ensure the token has DNS edit permissions on the correct zone.
|
||||
- HTTP-01 fails:
|
||||
- Ensure port 80 is open and routed to Traefik.
|
||||
- Check firewall, NAT, and upstream proxy settings.
|
||||
|
||||
## Quick rollback
|
||||
|
||||
If issuance fails, switch back to the previous working challenge type in .env and restart Traefik:
|
||||
|
||||
```bash
|
||||
docker compose up -d traefik
|
||||
```
|
||||
Reference in New Issue
Block a user