1
1
version : ' 3'
2
2
services :
3
3
traefik :
4
- container_name : traefik-v2
5
- image : traefik:v2.3
4
+ container_name : traefik
5
+ image : traefik:v2.4
6
6
restart : unless-stopped
7
7
healthcheck :
8
8
test : ["CMD-SHELL", "wget -q --spider localhost:8080/ping || exit 1"]
@@ -13,8 +13,15 @@ services:
13
13
# - "--api.debug=true"
14
14
- " --ping=true"
15
15
- " --entrypoints.http.address=:80"
16
+ - " --entryPoints.http.forwardedHeaders.trustedIPs=$TRUST_IPS"
17
+ - " --entrypoints.http.http.redirections.entryPoint.to=https"
18
+ - " --entrypoints.http.http.redirections.entryPoint.scheme=https"
19
+ - " --entrypoints.http.http.redirections.entrypoint.permanent=true"
16
20
- " --entrypoints.https.address=:443"
17
- - " --entryPoints.web.forwardedHeaders.trustedIPs=172.18.0.0/24,192.168.31.0/24"
21
+ - " --entryPoints.https.forwardedHeaders.trustedIPs=$TRUST_IPS"
22
+ - " --entrypoints.https.http.tls.certResolver=le"
23
+ - " --entrypoints.https.http.tls.domains[0].main=$CERT_DOMAIN_MAIN"
24
+ - " --entrypoints.https.http.tls.domains[0].sans=$CERT_DOMAIN_SANS"
18
25
- " --log.level=WARN"
19
26
- " --log.filePath=/logs/traefik.log"
20
27
- " --log.format=json"
@@ -58,10 +65,10 @@ services:
58
65
- " traefik.docker.network=traefik"
59
66
- " traefik.http.routers.traefik.service=api@internal"
60
67
# 默认请求转发 https 端口
61
- - " traefik.http.routers.traefik-dash-default.middlewares=https-redirect@file"
62
- - " traefik.http.routers.traefik-dash-default.entrypoints=http"
63
- - " traefik.http.routers.traefik-dash-default.rule=Host(`admin.example.com`)"
64
- - " traefik.http.routers.traefik-dash.service=dashboard@internal"
68
+ # - "traefik.http.routers.traefik-dash-default.middlewares=https-redirect@file"
69
+ # - "traefik.http.routers.traefik-dash-default.entrypoints=http"
70
+ # - "traefik.http.routers.traefik-dash-default.rule=Host(`admin.example.com`)"
71
+ # - "traefik.http.routers.traefik-dash.service=dashboard@internal"
65
72
# 处理网页
66
73
- " traefik.http.middlewares.basic-auth.basicauth.users=$AUTH_USER_LIST"
67
74
- " traefik.http.routers.traefik-dash-web.middlewares=basic-auth"
0 commit comments