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協議的
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章