Skip to content

Commit e92b6ce

Browse files
committed
[traefik] bump version to v2.4 and update config
1 parent b8790a6 commit e92b6ce

File tree

4 files changed

+39
-38
lines changed

4 files changed

+39
-38
lines changed

traefik/conf/default.yml

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
http:
2-
middlewares:
3-
https-redirect:
4-
redirectScheme:
5-
scheme: https
6-
permanent: false
7-
port: 5443
8-
content-compress:
9-
compress: {}
2+
# middlewares:
3+
# https-redirect:
4+
# redirectScheme:
5+
# scheme: https
6+
# permanent: false
7+
# port: 5443
8+
# content-compress:
9+
# compress: {}
1010

11-
services:
12-
# tricks https://github.com/containous/traefik/issues/4863#issuecomment-491093096
13-
dummy:
14-
loadBalancer:
15-
servers:
16-
- url: "" # or url: "localhost"
11+
# services:
12+
# # tricks https://github.com/containous/traefik/issues/4863#issuecomment-491093096
13+
# dummy:
14+
# loadBalancer:
15+
# servers:
16+
# - url: "" # or url: "localhost"
1717

18-
routers:
19-
https-redirect:
20-
entryPoints:
21-
- http
22-
rule: "HostRegexp(`{any:.*}`)"
23-
service: "dummy"
24-
middlewares:
25-
- "https-redirect"
18+
# routers:
19+
# https-redirect:
20+
# entryPoints:
21+
# - http
22+
# rule: "HostRegexp(`{any:.*}`)"
23+
# service: "dummy"
24+
# middlewares:
25+
# - "https-redirect"
2626

2727
tls:
2828
# certificates:

traefik/conf/nas.yml

+1-7
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,4 @@ http:
2020
- https
2121
service: nas
2222
rule: "Host(`www.example.com`)"
23-
tls:
24-
certResolver: le
25-
domains:
26-
- main: "*.example.com"
27-
sans:
28-
- "example.com"
29-
- "*.example.com"
23+
tls: {}

traefik/docker-compose.yml

+14-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
version: '3'
22
services:
33
traefik:
4-
container_name: traefik-v2
5-
image: traefik:v2.3
4+
container_name: traefik
5+
image: traefik:v2.4
66
restart: unless-stopped
77
healthcheck:
88
test: ["CMD-SHELL", "wget -q --spider localhost:8080/ping || exit 1"]
@@ -13,8 +13,15 @@ services:
1313
# - "--api.debug=true"
1414
- "--ping=true"
1515
- "--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"
1620
- "--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"
1825
- "--log.level=WARN"
1926
- "--log.filePath=/logs/traefik.log"
2027
- "--log.format=json"
@@ -58,10 +65,10 @@ services:
5865
- "traefik.docker.network=traefik"
5966
- "traefik.http.routers.traefik.service=api@internal"
6067
# 默认请求转发 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"
6572
# 处理网页
6673
- "traefik.http.middlewares.basic-auth.basicauth.users=$AUTH_USER_LIST"
6774
- "traefik.http.routers.traefik-dash-web.middlewares=basic-auth"

traefik/ssl/cert_req.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ csr=${key%.key}.csr
66

77
openssl req -new -sha256 \
88
-key $key \
9-
-subj "/C=CN/ST=Beijing/L=Beijing/O=bensonfx.cc/CN=*.bensonfx.cc" \
9+
-subj "/C=CN/ST=Beijing/L=Beijing/O=bensonfx.net/CN=*.bensonfx.net" \
1010
-reqexts SAN \
1111
-config <(cat /etc/ssl/openssl.cnf \
12-
<(printf "[SAN]\nsubjectAltName=DNS:*.bensonfx.cc,DNS:bensonfx.cc")) \
12+
<(printf "[SAN]\nsubjectAltName=DNS:*.bensonfx.net,DNS:bensonfx.net,DNS:*.bensonfx.app, DNS:bensonfx.app")) \
1313
-out $csr

0 commit comments

Comments
 (0)