perfect traefik.yml config

This commit is contained in:
lab 2021-12-10 14:44:51 +08:00
parent 609ae67567
commit 5d40b40a39
2 changed files with 39 additions and 9 deletions

View File

@ -1,21 +1,29 @@
version: "3.9"
services:
reverse-proxy:
traefik-reverse-proxy:
image: traefik:v2.5
ports:
- "80:80"
- "443:443"
environment:
- "TZ=Asia/Shanghai"
- LINODE_TOKEN=${LINODE_TOKEN}
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik-dashboard.rule=Host(`traefik.esin.io`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))"
- "traefik.http.routers.traefik-dashboard.tls=true"
- "traefik.http.routers.traefik-dashboard.service=api@internal"
- "traefik.http.routers.traefik-dashboard.middlewares=traefik-dashboard-auth"
- "traefik.http.middlewares.traefik-dashboard-auth.basicauth.users=${AUTH_USER}:${AUTH_PASS}"
- "traefik.http.middlewares.traefik-dashboard.compress=true"
- "traefik.http.middlewares.traefik-dashboard.compress.excludedcontenttypes=text/event-stream"
volumes:
- ./traefik/acme.json:/etc/acme/acme.json
- ./traefik/log:/var/log/traefik
- ./traefik/config/dynamic.d:/etc/traefik/dynamic.d:ro
- ./traefik/config/static.yml:/etc/traefik/traefik.yml:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./conf:/etc/traefik/config
- ./acme.json:/etc/acme/acme.json
- ./log:/var/log
- ./traefik.yml:/etc/traefik/traefik.yml:ro
networks:
- traefik

View File

@ -1,14 +1,32 @@
global:
sendanonymoususage: false
checknewversion: false
entryPoints:
web:
address: ":80"
http:
redirections:
entryPoint:
to: websecure
scheme: https
websecure:
address: ":443"
http:
tls:
certresolver: letsencrypt
domains:
- main: "esin.io"
sans: "*.esin.io"
providers:
docker:
watch: true
network: traefik
exposedByDefault: false
file:
directory: "/etc/traefik/config"
watch: true
directory: "/etc/traefik/dynamic.d"
api:
dashboard: true
@ -20,15 +38,19 @@ certificatesResolvers:
acme:
email: "hi@esin.io"
storage: "/etc/acme/acme.json"
tlsChallenge: {}
httpChallenge:
entryPoint: web
dnschallenge:
provider: linode
delayBeforeCheck: 0
log:
filePath: "/var/log/traefik.log"
filePath: "/var/log/traefik/traefik.log"
format: json
level: INFO
accessLog:
filePath: "/var/log/access.log"
filePath: "/var/log/traefik/access.log"
format: json
bufferingSize: 100