docs: add custom certificate alternative to Traefik ACME switching guide
This commit is contained in:
@@ -82,3 +82,66 @@ If issuance fails, switch back to the previous working challenge type in .env an
|
|||||||
```bash
|
```bash
|
||||||
docker compose up -d traefik
|
docker compose up -d traefik
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Alternative method: use your own certificate files (no ACME)
|
||||||
|
|
||||||
|
Use this method if you already have a certificate and private key and do not want Traefik to request certificates from Let's Encrypt.
|
||||||
|
|
||||||
|
1. Place your certificate and key files in the mounted cert directory:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp your-cert-fullchain.pem certs/custom.crt
|
||||||
|
cp your-private-key.pem certs/custom.key
|
||||||
|
chmod 644 certs/custom.crt
|
||||||
|
chmod 600 certs/custom.key
|
||||||
|
```
|
||||||
|
|
||||||
|
Important: `certs/custom.crt` should contain the leaf certificate plus intermediate chain in PEM format.
|
||||||
|
|
||||||
|
2. Configure Traefik dynamic TLS certs in `config/traefik/dynamic/certs.yml`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tls:
|
||||||
|
certificates:
|
||||||
|
- certFile: /certs/custom.crt
|
||||||
|
keyFile: /certs/custom.key
|
||||||
|
stores:
|
||||||
|
- default
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Switch services to static TLS mode in `.env`:
|
||||||
|
|
||||||
|
```env
|
||||||
|
TRAEFIK_SERVICES_TLS_CONFIG=tls=true
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Restart Traefik:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose up -d traefik
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Verify the served certificate:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
echo | openssl s_client -connect your-server-ip:443 -servername your-domain.tld 2>/dev/null | openssl x509 -noout -subject -issuer -dates
|
||||||
|
```
|
||||||
|
|
||||||
|
### Wildcard option for multiple subdomains
|
||||||
|
|
||||||
|
For domains like `cloud.example.com`, `git.example.com`, and `odoo.example.com`, you can use one wildcard certificate for `*.example.com`.
|
||||||
|
|
||||||
|
Example dynamic config:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
tls:
|
||||||
|
certificates:
|
||||||
|
- certFile: /certs/wildcard.example.com.crt
|
||||||
|
keyFile: /certs/wildcard.example.com.key
|
||||||
|
stores:
|
||||||
|
- default
|
||||||
|
```
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
- Wildcards cover one label only (`*.example.com`), not the apex (`example.com`) unless it is included separately.
|
||||||
|
- Keep `TRAEFIK_SERVICES_TLS_CONFIG=tls=true` while using custom certificates.
|
||||||
Reference in New Issue
Block a user