Docker-compose traefik Namecheap dns 不工作

Docker-compose traefik Namecheap dns not working

我有以下设置:

docker-compose.yml:

version: '3'

services:
  traefik:
    image: traefik:latest
    container_name: traefik
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    networks:
      - proxy
    ports:
      - 80:80
      - 443:443
    environment:
      - NAMECHEAP_API_USER=<removedforsecurity>
      - NAMECHEAP_API_KEY=<removedforsecurity>
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /home/pi/traefik/data/traefik.yml:/traefik.yml:ro
      - /home/pi/traefik/data/acme.json:/acme.json
      - /home/pi/traefik/data/config.yml:/config.yml:ro
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.traefik.entrypoints=http"
      - "traefik.http.routers.traefik.rule=Host(`traefik-dashboard.local.haywirehax.com`)"
      - "traefik.http.middlewares.traefik-auth.basicauth.users=<removedforsecurity>"
      - "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto=https"
      - "traefik.http.routers.traefik.middlewares=traefik-https-redirect"
      - "traefik.http.routers.traefik-secure.entrypoints=https"
      - "traefik.http.routers.traefik-secure.rule=Host(`traefik-dashboard.local.haywirehax.com`)"
      - "traefik.http.routers.traefik-secure.middlewares=traefik-auth"
      - "traefik.http.routers.traefik-secure.tls=true"
      - "traefik.http.routers.traefik-secure.tls.certresolver=namecheap"
      - "traefik.http.routers.traefik-secure.tls.domains[0].main=local.haywirehax.com"
      - "traefik.http.routers.traefik-secure.tls.domains[0].sans=*.local.haywirehax.com"
      - "traefik.http.routers.traefik-secure.service=api@internal"

networks:
  proxy:
    external: true

和traefik.yml:

api:
  dashboard: true
  debug: true
entryPoints:
  http:
    address: ":80"
  https:
    address: ":443"
serversTransport:
  insecureSkipVerify: true
providers:
  docker:
    endpoint: "unix:///var/run/docker.sock"
    exposedByDefault: false
  file:
    filename: /config.yml
certificatesResolvers:
  namecheap:
    acme:
      email: <myemail>
      storage: acme.json
      dnsChallenge:
        provider: namecheap
        resolvers:
          - "1.1.1.1:53"
          - "1.0.0.1:53"

但是,当我转到仪表板时,我没有获得 let's encrypt 证书。相反,我得到了默认的 traefik 一个。我的猜测是,这是由于以下部分不正确,但我找不到任何地方可以为 namecheap 正确地做到这一点。

certificatesResolvers:
  namecheap:
    acme:
      email: <myemail>
      storage: acme.json
      dnsChallenge:
        provider: namecheap
        resolvers:
          - "1.1.1.1:53"
          - "1.0.0.1:53"

我将解析器更改为我的内部 DNS 服务器,现在它可以工作了,我的错。