docker 404当尝试访问traefik Jmeter 板

vmjh9lq9  于 2022-12-18  发布在  Docker
关注(0)|答案(1)|浏览(156)

我尝试以简单的方式通过子域traefiktraefik.DOMAIN.com)访问traefik。当我获得访问权限时,SSL证书运行良好,但无法访问 Jmeter 板(404错误)

停靠-编写.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

交通工具

[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

yhxst69z

yhxst69z1#

在阅读了文档并检查了调试模式下的日志后,我能够使它工作。这里的key是尾随的/,也就是mandatory

交通工具

[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"

[log]
  level = "DEBUG"

[api]
  dashboard = true
  insecure = false

[accessLog]

[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]

停靠-编写.yaml

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.mydomain.com`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))"
      - "traefik.http.routers.api.service=api@internal"
      - "traefik.http.routers.api.entrypoints=websecure"
    networks:
      - web
networks:
  web:
    external: true

文件

ls
acme.json  docker-compose.yaml  traefik.toml

curl -s -o /dev/null -w "%{http_code}" https://traefik.mydomain.com/dashboard/
200

curl -s -o /dev/null -w "%{http_code}" https://traefik.mydomain.com/dashboard
404

下面是截图

相关问题