Hi!
I have a the next docker infrastructure:
- Traefik v2.0 as a reverse proxy
- Nginx as a web server
- Wordpress multisite as an app with two sites: Site1 and Site2
- 2 FQDN: domainA.com ($DOMAIN_A) and domainB.com ($DOMAIN_B)
All of this dockerized and deployed through docker-compose and I managed to route domainA to Site1, and domainB to Site2 working flawlessly
Now, for the HTTPS I did follow traefik's doc(v2) for automatic SSL with Let's Encrypt and achieved that Site1 was served as https://domainA (Site1)
The problem is that I'm trying to replicate the same configuration for for domainB (Site2), but It's been impossible
Is this even possible with automatic HTTPS?
All the related doc/post I find googling it are about a domains/subdomains with wildcards.
Anyone with the same problem?
Given the configuration below... Am I doing something wrong?
Thanks in advance
TRAEFIK
# Traefik container declared in docker-compose.yml
traefik:
container_name: traefik
image: "traefik:2.1"
restart: "always"
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./traefik.yml:/etc/traefik/traefik.yml
networks:
- "traefik_network"
labels:
- "traefik.enable=true"
- "traefik.http.routers.api.rule=Host(`traefik.$DOMAIN_A`)"
- "traefik.http.routers.api.entrypoints=http"
- "traefik.http.routers.api.service=api@internal"
nginx:
container_name: nginx
image: nginx:1.15.12-alpine
restart: unless-stopped
expose:
- 80
volumes:
- ./nginx-conf:/etc/nginx/conf.d
networks:
- traefik_network
- webserver_network
labels:
- "traefik.enable=true"
- "traefik.http.routers.domain_a_no_secured.entrypoints=http"
- "traefik.http.routers.domain_a_no_secured.rule=Host(`${DOMAIN_A}`)"
- "traefik.http.routers.domain_a_secured.entrypoints=https"
- "traefik.http.routers.domain_a_secured.rule=Host(`${DOMAIN_A}`)"
- "traefik.http.routers.domain_a_secured.tls.certresolver=myresolver"
- "traefik.http.routers.domain_b_no_secured.entrypoints=http"
- "traefik.http.routers.domain_b_no_secured.rule=Host(`${DOMAIN_B}`)"
- "traefik.http.routers.domain_b_secured.entrypoints=https"
- "traefik.http.routers.domain_b_secured.rule=Host(`${DOMAIN_B}`)"
- "traefik.http.routers.domain_b_secured.tls.certresolver=myresolver"
TRAEFIK STATIC CONFIGURATION FILE
#file traefik.yml
entryPoints:
http:
address: ":80"
https:
address: ":443"
providers:
docker:
exposedByDefault: false
certificatesResolvers:
myresolver:
acme:
email: my.emaila@gmail.com
storage: "/letsencrypt/acme.json"
httpChallenge:
entryPoint: http
NGINX
nginx:
container_name: nginx
image: nginx:1.15.12-alpine
restart: unless-stopped
expose:
- 80
volumes:
- ./nginx-conf:/etc/nginx/conf.d
networks:
- traefik_network
- webserver_network
labels:
- "traefik.enable=true"
- "traefik.http.routers.domain_a_no_secured.entrypoints=http"
- "traefik.http.routers.domain_a_no_secured.rule=Host(`domaina.com`,`www.domaina.com`)"
- "traefik.http.routers.domain_a_secured.entrypoints=https"
- "traefik.http.routers.domain_a_secured.rule=Host(`domaina.com`,`www.domaina.com`)"
- "traefik.http.routers.domain_a_secured.tls.certresolver=myresolver"
- "traefik.http.routers.domain_b_no_secured.entrypoints=http"
- "traefik.http.routers.domain_b_no_secured.rule=Host(`domainb.com`,`www.domainb.com`)"
- "traefik.http.routers.domain_b_secured.entrypoints=https"
- "traefik.http.routers.domain_b_secured.rule=Host(`domainb.com`,`www.domainb.com`)"
- "traefik.http.routers.domain_b_secured.tls.certresolver=myresolver"