Now if we were to put everything together into our static Traefik config file, it would look something like the below. Use your favourite method for adding/editing the file and paste it below. In our example, we will use the simple command-line file editor nano. Anywhere you see YOURDOMAIN.COM or YOUR@EMAIL.COM, make sure to change that out for your own information.
nano /opt/appdata/traefik/traefik.yml
traefik.yml
global:checkNewVersion:truesendAnonymousUsage:falseserversTransport:insecureSkipVerify:trueentryPoints:# Not used in apps, but redirect everything from HTTP to HTTPShttp:address::80forwardedHeaders:trustedIPs:&trustedIps# Start of Clouflare public IP list for HTTP requests, remove this if you don't use it - 173.245.48.0/20 - 103.21.244.0/22 - 103.22.200.0/22 - 103.31.4.0/22 - 141.101.64.0/18 - 108.162.192.0/18 - 190.93.240.0/20 - 188.114.96.0/20 - 197.234.240.0/22 - 198.41.128.0/17 - 162.158.0.0/15 - 104.16.0.0/12 - 172.64.0.0/13 - 131.0.72.0/22 - 2400:cb00::/32 - 2606:4700::/32 - 2803:f800::/32 - 2405:b500::/32 - 2405:8100::/32 - 2a06:98c0::/29 - 2c0f:f248::/32# End of Cloudlare public IP listhttp:redirections:entryPoint:to:httpsscheme:https# HTTPS endpoint, with domain wildcardhttps:address::443forwardedHeaders:# Reuse list of Cloudflare Trusted IP's above for HTTPS requeststrustedIPs:*trustedIpshttp:tls:# Generate a wildcard domain certificatecertResolver:letsencryptdomains: - main:YOURDOMAIN.COMsans: - '*.YOURDOMAIN.COM'middlewares: - securityHeaders@fileproviders:providersThrottleDuration:2s# File provider for connecting things that are outside of docker / defining middlewarefile:filename:/etc/traefik/fileConfig.ymlwatch:true# Docker provider for connecting all apps that are inside of the docker networkdocker:watch:truenetwork:proxy# Add Your Docker Network Name Here# Default host rule to containername.domain.exampledefaultRule:"Host(`{{ index .Labels \"com.docker.compose.service\"}}.YOURDOMAIN.COM`)"swarmModeRefreshSeconds:15s#comment out or remove this line if using traefik v3exposedByDefault:false#endpoint: "tcp://dockersocket:2375" # Uncomment if you are using docker socket proxy# Enable traefik uiapi:dashboard:trueinsecure:true# Log level INFO|DEBUG|ERRORlog:level:INFO# Use letsencrypt to generate ssl serficiatescertificatesResolvers:letsencrypt:acme:email:YOUR@EMAIL.COMstorage:/etc/traefik/acme.jsondnsChallenge:provider:cloudflare# Used to make sure the dns challenge is propagated to the rights dns serversresolvers: - "1.1.1.1:53" - "1.0.0.1:53"