Hello,
Thank you so much for the great opensource software.
I see a lack of documentation for custom SSL configuration.
I would like to configure my own SSL certificate for a domain.
But I could not get the configured domain.
Traefik always returns default SSL.
can anyone guide me to fix my issue?
I run everything on docker-compose file
Traefik YAML file:
version: "3.3"
services:
traefik:
image: "traefik:v2.0"
container_name: "traefik"
restart: always
command:
- "--global.sendAnonymousUsage=false"
- "--api=true"
- "--api.insecure=true"
- "--api.dashboard=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.rule=Host(`traefik.192.168.1.21.nip.io`)"
- "traefik.http.routers.traefik.entrypoints=web"
- "traefik.http.services.traefik.loadbalancer.server.port=8080"
ports:
- "80:80"
- "443:443"
volumes:
- "/storage/docker/apps/traefik:/traefik"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
traefik directory:
$ cat /storage/docker/apps/traefik/file_provider.yaml
tls:
certificates:
- certFile: /traefik/tls/nginx.cert
keyFile: /traefik/tls/nginx.key
stores:
default: {}
$ tree /storage/docker/apps/traefik/
/storage/docker/apps/traefik/
├── file_provider.yaml
└── tls
├── nginx.cert
└── nginx.key
1 directory, 3 files
Nginx configuration with my custom SSL certificate:
version: '2.2'
services:
nginx:
image: "nginx:alpine"
container_name: "nginx"
labels:
- "traefik.enable=true"
- "traefik.http.routers.nginx.rule=Host(`nginx.192.168.1.21.nip.io`)"
- "traefik.http.routers.nginx.tls=true"
- "traefik.http.routers.nginx.tls.domains[0].main=nginx"
- "traefik.http.routers.nginx.tls.domains[0].sans=nginx"
- "traefik.http.routers.nginx.entrypoints=websecure"
- "traefik.http.services.nginx.loadbalancer.server.port=80"
Thanks,
-Jeeva