Traefik version 2 only shows 404 or no website at all
You can find a working example for traefik 2.2.1. Also, you can check full setup gist: https://gist.github.com/fatihyildizhan/8f124039a9bd3801f0caf3c01c3601fb
I prefer to use traefik.yml with version 2.0. It looks simple and many people are familiar with the YAML files.
[Traefik v2.0] - docker-compose.yml with httpChallenge version: '3.7' services: traefik: image: traefik:v2.2.1 container_name: traefik restart: unless-stopped security_opt: - no-new-privileges:true networks: - proxy ports: - 80:80 - 443:443 volumes: - /etc/localtime:/etc/localtime:ro - /var/run/docker.sock:/var/run/docker.sock:ro - ./traefik.yml:/traefik.yml:ro - ./acme.json:/acme.json labels: - "traefik.enable=true" - "traefik.http.routers.traefik.entrypoints=http" - "traefik.http.routers.traefik.rule=Host(`traefik.your-domain.com`)" - "traefik.http.middlewares.traefik-auth.basicauth.users=username:hashed-password" - "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https" - "traefik.http.routers.traefik.middlewares=traefik-https-redirect" - "traefik.http.routers.traefik-secure.entrypoints=https" - "traefik.http.routers.traefik-secure.rule=Host(`traefik.your-domain.com`)" - "traefik.http.routers.traefik-secure.middlewares=traefik-auth" - "traefik.http.routers.traefik-secure.tls=true" - "traefik.http.routers.traefik-secure.tls.certresolver=http" - "traefik.http.routers.traefik-secure.service=api@internal" - "traefik.http.services.traefik.loadbalancer.server.port=8080" networks: proxy: external: true [Traefik v2.0] - traefik.yml with httpChallenge api: dashboard: true # Writing Logs to a File, in JSON log: level: DEBUG filePath: "log-file.log" format: json # Configuring a buffer of 100 lines accessLog: filePath: "log-access.log" bufferingSize: 100 entryPoints: http: address: ":80" https: address: ":443" providers: docker: endpoint: "unix:///var/run/docker.sock" exposedByDefault: false certificatesResolvers: http: acme: email: your-email.com storage: acme.json httpChallenge: entryPoint: http [Traefik v2.0] - your-container docker-compose.yml version: '3.7' services: your-container-name: image: docker.pkg.github.com/username/repo-name/image-name:latest container_name: your-container-name restart: unless-stopped security_opt: - no-new-privileges:true networks: - proxy volumes: - /etc/localtime:/etc/localtime:ro - /var/run/docker.sock:/var/run/docker.sock:ro - ./data:/data labels: - "traefik.enable=true" - "traefik.http.routers.your-container-name.entrypoints=http" - "traefik.http.routers.your-container-name.rule=Host(`your-container-name.your-domain.com`)" - "traefik.http.middlewares.your-container-name-https-redirect.redirectscheme.scheme=https" - "traefik.http.routers.your-container-name.middlewares=your-container-name-https-redirect" - "traefik.http.routers.your-container-name-secure.entrypoints=https" - "traefik.http.routers.your-container-name-secure.rule=Host(`your-container-name.your-domain.com`)" - "traefik.http.routers.your-container-name-secure.tls=true" - "traefik.http.routers.your-container-name-secure.tls.certresolver=http" - "traefik.http.routers.your-container-name-secure.service=your-container-name" - "traefik.http.services.your-container-name.loadbalancer.server.port=80" - "traefik.docker.network=proxy" networks: proxy: external: true