traefik添加证书报错:404 page not found

traefik作为前端代理,http协议是正常的,但是添加HTTPS证书就出现404,解决方法如下:

traefik.toml 的ssl配置如下

# 默认是http入口,要开启https入口才可访问
defaultEntryPoints = ["http","https"]
[entryPoints]
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
      entryPoint = "https"
  [entryPoints.https]
  address = ":443"
    [entryPoints.https.tls]
      [[entryPoints.https.tls.Certificates]]
        certFile = '/ssl/nginx.crt'
        keyFile = '/ssl/nginx.key'

还要注意:

  • 证书文件和秘钥文件是容器里的路径而不是本地路径
  • traefik路由流量到后端是http协议的

你可能感兴趣的:(traefik,docker)