I am setting up my VPS ($3.5 amazon free trier) with docker + traefik then I got a problem with traefik in swarm mode. Everything is running as well (traefik, https, docker). Although, I can access and see Traefik dashboard in srv1.webee.asia:8080, I always got 404 page not found when access the website in browser without 8080. The error log is "backend not found". I spent a day but am not resolved this problem. Anyone here for help!
There are my configs:
defaultEntryPoints = ["http", "https"]
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
compress = true
[entryPoints.https.tls]
[entryPoints.https.forwardedHeaders]
[entryPoints.traefik]
address = ":8080"
[entryPoints.traefik.auth]
[entryPoints.traefik.auth.basic]
users = ["admin:secret"]
[acme]
email = "contact@webee.asia"
storage = "acme.json"
entryPoint = "https"
onHostRule = true
[acme.httpChallenge]
entryPoint = "http"
[api]
entryPoint = "traefik"
dashboard = true
version: '3.6'
networks:
traefik:
name: traefik
configs:
traefik.toml:
external: true
name: ${CONFIG_FILE:-traefik.toml}
services:
traefik:
image: traefik:1.7
command:
- --docker
- --docker.watch
- --docker.swarmMode=true
- --docker.network=traefik
- --docker.domain=${DOMAIN}
- --docker.exposedbydefault=false
- --configfile=/etc/traefik/traefik.toml
- --loglevel=${LOG_LEVEL:-INFO}
ports:
- 80:80
- 443:443
- 8080:8080
networks:
- traefik
configs:
- source: traefik.toml
target: /etc/traefik/traefik.toml
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /opt/traefik/acme.json:/acme.json
- /var/log/traefik:/var/log/traefik
deploy:
mode: global
placement:
constraints:
- node.role == manager
update_config:
delay: 4s
order: stop-first
labels:
- traefik.enable=true
- traefik.port=8080
- traefik.frontend.rule=Host:${DOMAIN}
Access dashboard directly via 8080: