使用 Docker Compose 在 Traefik 中配置 TLS 1.3
要在 Traefik 中使用 Docker Compose 设置 TLS 1.3,您需要执行以下步骤:
- 在 Traefik 配置文件中启用 TLS 1.3 支持。要这样做,请在配置文件的
[entryPoints]部分中将tls的最小版本设置为 'VersionTLS13',如下所示:
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.web.http.redirections.entryPoint]
to = "websecure"
scheme = "https"
[entryPoints.websecure]
address = ":443"
[entryPoints.websecure.http.tls]
minVersion = 'VersionTLS13'
- 在 Docker Compose 文件中将 Traefik 容器的 TLS 选项设置为 'true',如下所示:
version: '3.8'
services:
traefik:
image: traefik:v2.5
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedByDefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--entrypoints.websecure.http.tls=true"
ports:
- "80:80"
- "443:443"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- 运行 Docker Compose 文件以启动 Traefik 容器。在容器运行后,您应该能够使用 TLS 1.3 启动 HTTPS 连接。
请注意,使用 TLS 1.3 需要 Traefik 和客户端浏览器都支持该协议。如果您的浏览器不支持 TLS 1.3,则无法建立 TLS 1.3 连接。
原文地址: https://www.cveoy.top/t/topic/mG0j 著作权归作者所有。请勿转载和采集!