Treafik 版本 2.5Traefik.toml 文件# 入口点配置[entryPoints] [entryPoints.web] 地址 = \':80\' [entryPoints.websecure] 地址 = \':443\' [
Treafik 版本 2.5
Traefik.toml 文件
# Entry Points Configuration
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.websecure]
address = ":443"
[entryPoints.websecure.http.tls]
# Providers Configuration
[providers]
[providers.docker]
endpoint = "unix:///var/run/docker.sock"
exposedByDefault = false
# TLS Certificates Configuration
[tls]
[[tls.certificates]]
certFile = "/certs/certificate.crt"
keyFile = "/certs/private.key"
stores = ["default"]
# TLS Stores Configuration
[tls.stores]
[tls.stores.default]
[tls.stores.default.defaultCertificate]
certFile = "/certs/certificate.crt"
keyFile = "/certs/private.key"
# TLS Options Configuration
[tls.options]
[tls.options.default]
minVersion = "VersionTLS12"
maxVersion = "VersionTLS13"
cipherSuites = [
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"
]
curvePreferences = ["CurveP521", "CurveP384"]
sniStrict = true
# API Configuration
[api]
dashboard = true
insecure = true
docker-compose.yml 文件
version: '3.3'
services:
traefik:
image: traefik:v2.5
command:
- --configFile=/traefik.toml
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "/certs:/certs"
- "./traefik.toml:/traefik.toml"
labels:
- "traefik.enable=true"
- "traefik.http.routers.api.rule=Host(`example`)"
- "traefik.http.routers.api.service=api@internal"
- "traefik.http.routers.api.entrypoints=websecure"
backend:
build: ./backend
labels:
- "traefik.enable=true"
- "traefik.http.routers.backend.rule=Host(`example`)"
- "traefik.http.services.backend.loadbalancer.server.port=4000"
- "traefik.http.routers.backend.entrypoints=websecure"
env_file:
- ./backend/.env
volumes:
- ./backend/upload/images:/app/backend/upload/images
frontend:
build: ./frontend
labels:
- "traefik.enable=true"
- "traefik.http.routers.frontend.rule=Host(`example`, `example`)"
- "traefik.http.services.frontend.loadbalancer.server.port=3000"
- "traefik.http.routers.frontend.entrypoints=websecure"
env_file:
- ./frontend/.env
admin:
build: ./admin
labels:
- "traefik.enable=true"
- "traefik.http.routers.admin.rule=Host(`example`)"
- "traefik.http.services.admin.loadbalancer.server.port=5173"
- "traefik.http.routers.admin.entrypoints=websecure"
env_file:
- ./admin/.env
SSL Checker 状态:(查看图片)
我的 LCN DNS 记录:所有 A 都指向正确的 IP 地址
DNS 检查状态已解决
root@ubuntu-s-2vcpu-4gb-amd-lon1-01:/home/root/example# docker exec -it $(docker ps -qf "name=example_traefik_1") sh -c 'ls -l /certs; cat /traefik.toml'
total 8
-rw-r--r-- 1 root root 2244 Jun 24 10:53 certificate.crt
-rw------- 1 root root 1704 Jun 20 14:49 private.key
# Entry Points Configuration
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.websecure]
address = ":443"
[entryPoints.websecure.http.tls]
# Providers Configuration
[providers]
[providers.docker]
endpoint = "unix:///var/run/docker.sock"
exposedByDefault = false
# TLS Certificates Configuration
[tls]
[[tls.certificates]]
certFile = "/certs/certificate.crt"
keyFile = "/certs/private.key"
stores = ["default"]
# TLS Stores Configuration
[tls.stores]
[tls.stores.default]
[tls.stores.default.defaultCertificate]
certFile = "/certs/certificate.crt"
keyFile = "/certs/private.key"
# TLS Options Configuration
[tls.options]
[tls.options.default]
minVersion = "VersionTLS12"
maxVersion = "VersionTLS13"
cipherSuites = [
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"
]
curvePreferences = ["CurveP521", "CurveP384"]
sniStrict = true
# API Configuration
[api]
dashboard = true
insecure = true
完全不知道我遗漏了什么或者做错了什么?为什么它仍然分配默认证书而不是我的自定义证书?