Hi all,
First off I am new to Traefik, so sorry in advance if it's a dumb question. I am setting up my home lab and want everything to be over HTTPS / SSL without the "Your connection is not private" warning in any browser for any of the self-hosted services I am hosting.
I got halfway through getting things working in my home lab with a single subdomain wildcard certificate e.g. *.local.mydomain.com but then realized that it would be better to segregate the domains and subdomains.
So I would like to get the Traefik instance I have created, to serve all the following domains but I don't know if it supports it or even if LetsEncrypt supports it.
*.mydomain.com
*.media.mydomain.com
*.storage.mydomain.com
*.network.mydomain.com
*.service.mydomain.com
Can I configure the above domains in Traefik's docker-compose.yml file and what would be the changes or additions I will have to make to my existing file?
version: '3'
services:
traefik:
image: traefik:latest
container_name: traefik
restart: unless-stopped
security_opt:
- no-new-privileges:true
networks:
- proxy
ports:
- 80:80
- 443:443
environment:
- CF_API_EMAIL=azxczxczvasd@zxczxc.com
#- CF_DNS_API_TOKEN=YOU_API_TOKEN
- CF_API_KEY=czxczxczxczx
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- /home/traefik/data/traefik.yml:/traefik.yml:ro
- /home/traefik/data/acme.json:/acme.json
- /home/traefik/data/config.yml:/config.yml:ro
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.entrypoints=http"
- "traefik.http.routers.traefik.rule=Host(`proxy.service.mydomain.in`)"
- "traefik.http.middlewares.traefik-auth.basicauth.users=azxczxc:$$apr1$$2aw5tzxctnzxcCSx/"
# Note: all dollar signs in the hash need to be doubled for escaping for above password.
# https://hostingcanada.org/htpasswd-generator/ << Use the website to generate encrypted password.
- "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https"
- "traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto=https"
- "traefik.http.routers.traefik.middlewares=traefik-https-redirect"
- "traefik.http.routers.traefik-secure.entrypoints=https"
- "traefik.http.routers.traefik-secure.rule=Host(`proxy.service.mydomain.in`)"
- "traefik.http.routers.traefik-secure.middlewares=traefik-auth"
- "traefik.http.routers.traefik-secure.tls=true"
- "traefik.http.routers.traefik-secure.tls.certresolver=cloudflare"
- "traefik.http.routers.traefik-secure.tls.domains[0].main=service.mydomain.in"
- "traefik.http.routers.traefik-secure.tls.domains[0].sans=*.service.mydomain.in"
- "traefik.http.routers.traefik-secure.service=api@internal"
networks:
proxy:
external: true