[英]Expose Traefik dashboard to subdomain
我已經設置了 Traefix,我正在嘗試將儀表板暴露給通過 Cloudflare 和 SSL 提供服務的網站。 我已經梳理了文檔,但我一生都無法弄清楚如何將文檔暴露給我的一個網站的子域。 我有以下 docker-compose 文件:
services:
traefik:
container_name: traefik
image: "traefik"
labels:
- "traefik.enable=true"
- "traefik.http.routers.dashboard.rule=Host(`foo.bar.dev`) && PathPrefix(`/`)"
- "traefik.http.routers.dashboard.entrypoints=websecure"
- "traefik.http.routers.dashboard.service=dashboard@internal"
- "traefik.http.routers.dashboard.middlewares=dashboard_redirect@internal,dashboard_stripprefix@internal"
- "traefik.http.routers.dashboard.priority=2"
- "traefik.http.routers.api.rule=Host(`foo.bar.dev`) && PathPrefix(`/api`)"
- "traefik.http.routers.api.entrypoints=websecure"
- "traefik.http.routers.api.service=api@internal"
- "traefik.http.routers.api.priority=1"
- "traefik.http.routers.api.middlewares=dashboard_redirect@internal,dashboard_stripprefix@internal"
ports:
- "443:443"
- "8080:8080"
expose:
- 443
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./traefik.toml:/traefik.toml"
version: "3.3"
以及以下 traefik.toml 文件:
[accessLog]
[api]
dashboard = true
insecure = true
[providers.docker]
exposedByDefault = false
[entryPoints]
[entryPoints.websecure]
address = ":443"
我仍然在子域上得到 404。 證書是由 cloudflare 安排的,所以我登陸我網絡中的端口 443 沒有任何問題。 然后我的端口由我的路由器轉發到我的 Traefix 服務器。 我覺得主機規則沒有被觸發,因為當我直接從內部網絡中的 IP 訪問端口 8080 時,我可以訪問儀表板並查看 docker 中設置的兩個規則。
誰能指出我正確的方向?
我最終使它與以下配置一起工作:
version: "3.3"
services:
traefik:
container_name: traefik
image: "traefik"
networks:
- webgateway
labels:
- "traefik.enable=true"
- "traefik.http.routers.dashboard.rule=Host(`foo.bar.dev`)"
- "traefik.http.routers.dashboard.entrypoints=websecure"
- "traefik.http.routers.dashboard.tls"
- "traefik.http.services.dashboard.loadbalancer.server.port=8080"
ports:
- "443:443"
expose:
- 8080
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./traefik.toml:/traefik.toml"
networks:
webgateway:
driver: bridge
[log]
level = "DEBUG"
[accessLog]
[api]
dashboard = true
insecure = true
[providers.docker]
exposedByDefault = false
[entryPoints]
[entryPoints.websecure]
address = ":443"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.