I use this page to store some default configurations files for other post to reference from.
Create Files
1 2 3 4 5 6
| mkdir -p data/configurations touch docker-compose.yml touch data/traefik.yml touch data/acme.json touch data/configurations/dynamic.yml chmod 600 data/acme.json
|
Docker-compose
File location ~/docker-compose.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| version: '2.1'
services: traefik: image: traefik:v2.10 container_name: traefik restart: always security_opt: - no-new-privileges:true ports: - 80:80 - 443:443 volumes: - /etc/localtime:/etc/localtime:ro - /var/run/docker.sock:/var/run/docker.sock:ro - ./data/traefik.yml:/traefik.yml:ro - ./data/acme.json:/acme.json - ./data/configurations:/configurations networks: - proxy labels: - "traefik.enable=true" - "traefik.docker.network=proxy" - "traefik.http.routers.traefik-secure.entrypoints=websecure" - "traefik.http.routers.traefik-secure.rule=Host(`traefik.yourdomain`)" - "traefik.http.routers.traefik-secure.middlewares=user-auth@file" - "traefik.http.routers.traefik-secure.service=api@internal"
networks: proxy: external: true
|
Static Configuration
File location ~/data/traefik.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| api: dashboard: true
entryPoints: web: address: :80 http: redirections: entryPoint: to: websecure
websecure: address: :443 http: middlewares: - secureHeaders@file - nofloc@file tls: certResolver: letsencrypt
pilot: dashboard: false
providers: docker: endpoint: "unix:///var/run/docker.sock" exposedByDefault: false file: filename: /configurations/dynamic.yml
certificatesResolvers: letsencrypt: acme: email: admin@yourdomain storage: acme.json keyType: EC384 httpChallenge: entryPoint: web
buypass: acme: email: admin@yourdomain storage: acme.json caServer: https://api.buypass.com/acme/directory keyType: EC256 httpChallenge: entryPoint: web
|
Dynamic Configuration
File location ~/data/configurations/dynamic.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| http: middlewares: nofloc: headers: customResponseHeaders: Permissions-Policy: "interest-cohort=()" secureHeaders: headers: sslRedirect: true forceSTSHeader: true stsIncludeSubdomains: true stsPreload: true stsSeconds: 31536000
user-auth: basicAuth: users: - "admin:$apr1$tm53ra6x$FntXd6jcvxYM/YH0P2hcc1"
tls: options: default: cipherSuites: - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 - TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 - TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 minVersion: VersionTLS12
|