Hello,
I just started looking into Traefik a couple of days ago, and I'm still looking into how to configure it. Basically I want to host 2 wordpress websites and use Traefik as a reverse proxy. This is my docker-compose.yml
services:
traefik:
image: traefik
container_name: traefik
hostname: traefik
restart: unless-stopped
command:
- "--log.level=INFO"
- "--api.insecure=true"
- "--providers.docker=true"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.myresolver.acme.httpchallenge=true"
- "--certificatesresolvers.myresolver.acme.email=my@email.here"
- "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
environment:
- PUID=1001
- PGID=1001
ports:
- 80:80
- 443:443
- 8080:8080
volumes:
- traefik:/letsencrypt
- /var/run/docker.sock:/var/run/docker.sock
domain1.com:
image: wordpress
container_name: domain1.com
hostname: domain1.com
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.domain1com.tls=true"
- "traefik.http.routers.domain1com.entrypoints=websecure"
- "traefik.http.routers.domain1com.rule=Host(`domain1.com`)"
- "traefik.http.routers.domain1com.tls.certresolver=myresolver"
environment:
- PUID=1001
- PGID=1001
volumes:
- domain1.com:/var/www/html
domain2.com:
image: wordpress
container_name: domain2.com
hostname: domain2.com
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.domain2com.tls=true"
- "traefik.http.routers.domain2com.entrypoints=websecure"
- "traefik.http.routers.domain2com.rule=Host(`domain2.com`)"
- "traefik.http.routers.domain2com.tls.certresolver=myresolver"
environment:
- PUID=1001
- PGID=1001
volumes:
- domain2.com:/var/www/html
volumes:
traefik:
domain1.com:
domain2.com:
This is the log output in portainer:
2024-11-14T13:45:06Z INF Traefik version 3.2.0 built on 2024-10-28T14:49:00Z version=3.2.0
2024-11-14T13:45:06Z INF
Stats collection is disabled.
Help us improve Traefik by turning this feature on :)
More details on: https://doc.traefik.io/traefik/contributing/data-collection/
2024-11-14T13:45:06Z INF Starting provider aggregator aggregator.ProviderAggregator
2024-11-14T13:45:06Z INF Starting provider *traefik.Provider
2024-11-14T13:45:06Z INF Starting provider *acme.ChallengeTLSALPN
2024-11-14T13:45:06Z INF Starting provider *docker.Provider
2024-11-14T13:45:06Z INF Starting provider *acme.Provider
2024-11-14T13:45:06Z INF Testing certificate renew... acmeCA=https://acme-v02.api.letsencrypt.org/directory providerName=myresolver.acme
2024-11-14T13:45:10Z INF Register... providerName=myresolver.acme
When I try to visit either one of the domains, I get a message "404 page not found"
What I'm I doing wrong?