Docker-compose traefik Namecheap dns 不起作用
我有以下设置:
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"
但是,当我进入仪表板时,我没有得到让我们加密证书。相反,我得到了默认的 traefik 。我的猜测是,这是由于以下部分不正确,但我找不到任何地方可以正确地为 namecheap 执行此操作。
certificatesResolvers:
namecheap:
acme:
email: <myemail>
storage: acme.json
dnsChallenge:
provider: namecheap
resolvers:
- "1.1.1.1:53"
- "1.0.0.1:53"
I have the following setup:
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
and 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"
however, when I go to the dashboard, I don't get a let's encrypt cert. instead I get the default traefik one. My guess is that this is due to the following part that is incorrect, but I can't find anywhere where to do it correctly for namecheap.
certificatesResolvers:
namecheap:
acme:
email: <myemail>
storage: acme.json
dnsChallenge:
provider: namecheap
resolvers:
- "1.1.1.1:53"
- "1.0.0.1:53"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将解析器更改为我的内部 DNS 服务器,现在它可以工作了,这是我的错。
I changed the resolvers to my internal DNS server and now it works, my bad.