提供默认证书时“无默认证书,生成一个”

E. *_*aep 3 ssl https ssl-certificate traefik

这可能是一个关于 traefik 和 SSL 配置的新手问题。我想在 traefik 中使用我自己的(自签名,公司,...)证书。我试图遵循文档,但我不断收到以下消息:

... level=debug msg="没有默认证书,生成一个"

我的traefik.toml看起来像这样:

[entryPoints]
    [entryPoints.web]
    address = ":80"

    [entryPoints.web.http]
        [entryPoints.web.http.redirections]
        [entryPoints.web.http.redirections.entryPoint]
            to = "websecure"
            scheme = "https"

    [entryPoints.websecure]
    address = ":443"

[log]
    level = "DEBUG"
[api]
    insecure = true
    dashboard = true
[providers.docker]
    exposedByDefault = false

[[tls]]
  entryPoints = ["websecure"]

[[tls.certificate]]
    certFile = "/certs/cert.crt"
    keyFile = "/certs/cert.key"

[tls.stores]
  [tls.stores.default]
    [tls.stores.default.defaultCertificate]
      certFile = "/cert/cert.crt"
      keyFile  = "/cert/cert.key"

Run Code Online (Sandbox Code Playgroud)

我的docker-compose.yml样子是这样的:

[entryPoints]
    [entryPoints.web]
    address = ":80"

    [entryPoints.web.http]
        [entryPoints.web.http.redirections]
        [entryPoints.web.http.redirections.entryPoint]
            to = "websecure"
            scheme = "https"

    [entryPoints.websecure]
    address = ":443"

[log]
    level = "DEBUG"
[api]
    insecure = true
    dashboard = true
[providers.docker]
    exposedByDefault = false

[[tls]]
  entryPoints = ["websecure"]

[[tls.certificate]]
    certFile = "/certs/cert.crt"
    keyFile = "/certs/cert.key"

[tls.stores]
  [tls.stores.default]
    [tls.stores.default.defaultCertificate]
      certFile = "/cert/cert.crt"
      keyFile  = "/cert/cert.key"

Run Code Online (Sandbox Code Playgroud)

我很确定这是一件微不足道的事情,但我无法弄清楚(toml 语法和 traefik 概念都太多了,无法同时吞下)。

E. *_*aep 6

我终于通过关注这个博客发现了什么不起作用

我不得不:

  1. 将动态配置的文件提供程序添加到我的traefik.toml文件中:

    [providers.file]
    filename = "/tls-certs.toml"
    
    Run Code Online (Sandbox Code Playgroud)
  2. 将卷映射添加到我的docker-compose.yml文件:

    [providers.file]
    filename = "/tls-certs.toml"
    
    Run Code Online (Sandbox Code Playgroud)
  3. 提供一个tls-certs.toml文件:

    [[tls.certificates]] #first certificate
      certFile = "/certs/cert.crt"
      keyFile = "/certs/cert.key"
    
    Run Code Online (Sandbox Code Playgroud)