【问题标题】:404 when trying to access traefik dashboard尝试访问 traefik 仪表板时出现 404
【发布时间】:2020-07-27 13:42:17
【问题描述】:

我尝试以一种简单的方式通过子域traefik (traefik.DOMAIN.com) 访问 traefik。一旦我获得访问权限,SSL 证书就可以正常运行,但无法访问仪表板(404 错误)

docker-compose.yml

version: '3'

services:
  reverse-proxy:
    image: traefik:v2.2
    container_name: traefik
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - $PWD/traefik.toml:/etc/traefik/traefik.toml
      - $PWD/acme.json:/acme.json
    restart: always
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.api.rule=Host(`traefik.DOMAIN.com`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))"
      - "traefik.http.routers.api.service=api@internal"
      - "traefik.http.routers.api.entrypoints=websecure"
    networks:
      - web
networks:
  web:
    external: true

traefik.toml

[api]
  dashboard = true

[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"
      [entryPoints.websecure.http.tls]
        certResolver = "default"

[providers]
  [providers.docker]
    watch = true
    exposedByDefault = false
    network = "web"

[certificatesResolvers]
  [certificatesResolvers.default]
    [certificatesResolvers.default.acme]
      email = "EMAIL@gmail.com"
      storage = "acme.json"
      caServer = "https://acme-v01.api.letsencrypt.org/directory"
    [certificatesResolvers.default.acme.tlsChallenge]

关于如何完成这项工作的任何想法?我希望最终能够在子域上安装 owncloud

【问题讨论】:

  • 你有什么运气让它工作吗?你试过去https://traefik.DOMAIN.com/dashboard/,还是别的什么?在我的配置中,我使用了traefik.http.routers.dashboard... 而不是traefik.http.routers.api...,但我不确定这会产生什么不同。

标签: docker docker-compose traefik


【解决方案1】:

您必须添加 --api.insecure=true 全局参数,它应该可以工作。

所以在你的情况下,在 traefik.toml 中添加以下内容

[api]
  insecure = true

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-10-05
    • 2019-04-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多