docker - docker-compose 中的 Traefik 自签名证书通配符子域
问题描述
我正在寻找一种解决方案,让 traefik 为我的服务生成通配符证书。事实上,在本地开发中,我确实有多个服务共享同一个域,目前我必须接受每个服务的证书。
我有 2 个子域front.domain.localhost
,api.domain.localhost
并且我想为这两个子域提供一个证书。
这是一个演示docker-compose.yml:
version: '3'
services:
traefik:
image: traefik:2.5
command:
- --providers.docker
- --entryPoints.http.address=:80
- --entryPoints.http.http.redirections.entryPoint.to=https
- --entryPoints.http.http.redirections.entryPoint.scheme=https
- --entryPoints.https.address=:443
labels:
- traefik.enable=true
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
front:
image: traefik/whoami
labels:
- traefik.http.routers.front_router.rule=Host(`front.domain.localhost`)
- traefik.http.routers.front_router.entrypoints=https
- traefik.http.routers.front_router.tls=true
api:
image: traefik/whoami
labels:
- traefik.http.routers.api_router.rule=Host(`api.domain.localhost`)
- traefik.http.routers.api_router.entrypoints=https
- traefik.http.routers.api_router.tls=true
有了这个,我应该接受 2 个证书(每个子域一个)。
我尝试了各种组合,main
如sans
https://doc.traefik.io/traefik/routing/routers/#domains 中所述,但没有成功。
我怎样才能做到这一点?
解决方案
推荐阅读
- javascript - 在使用 Scully 的现有应用程序上生成角度静态 html 时出错
- c - 在格式规范之前使用逗号。在 C 中的 scanf 中?
- javascript - 如何在 PhpStorm 的 JavaScript 中启用 Emmet?
- python - PySide2:AttributeError:“NoneType”对象没有属性“objectName”
- python - 测试 SQLAlchemy 会话是否已关闭
- junit5 - 重新运行失败的测试junit5黄瓜
- cgal - 为 CGAL 的 Delaunay_triangulation_2 的 Delaunay 条件实现替代凸形
- mysql - 选择大陆中的城市 = 'Europe' with Max Population 但不使用连接 (MySQL)
- docker - 是否可以在错误时创建新容器?
- node.js - errorType”:“Runtime.UnhandledPromiseRejection”,“errorMessage”:“错误:Node.js 中的 getaddrinfo ENOTFOUND