在域名提供商购买下载证书,获取cert、key两个文件,放置在docker-compose目录下的certs文件夹中。
traefik当前(v2.3.2)只能用动态配置文件配置自定证书:
In the above example, we’ve used the file provider to handle these definitions. It is the only available method to configure the certificates (as well as the options and the stores). However, in Kubernetes, the certificates can and must be provided by secrets.
https://doc.traefik.io/traefik/https/tls/
准备traefik动态配置文件dyn.toml,如下:
# dyn.toml
[[tls.certificates]]
certFile = "/certs/www.xxx.cn.pem"
keyFile = "/certs/www.xxx.cn.key"