Reputation: 113
I tried this:
version: "3.3"
services:
traefik:
image: "traefik:latest"
command:
- --api.insecure=true
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --api=true
- --api.dashboard=true
- --entrypoints.web.address=:80
- --log.filePath=/home/docker/traefik.log
- --log.level=DEBUG
ports:
- "80:80"
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
whoami:
image: "containous/whoami"
labels:
- "traefik.enable=true"
- "traefik.http.routers.whoami.rule=Host(`whoami.traefik.kb`) && Path(`/who`)"
- "traefik.http.routers.whoami.entrypoints=web"
- "traefik.http.routers.whoami.service=whoami"
- "traefik.http.services.whoami.loadbalancer.server.port=80"
nginx:
image: "nginx:alpine"
labels:
- "traefik.enable=true"
- "traefik.http.routers.nginx.rule=Host(`nginx.traefik.kb`) && Path(`/ng`)"
- "traefik.http.routers.nginx.entrypoints=web"
- "traefik.http.routers.nginx.service=nginx"
- "traefik.http.services.nginx.loadbalancer.server.port=80"
nginx2:
image: "nginx:alpine"
labels:
- "traefik.enable=true"
- "traefik.http.routers.nginx2.rule=Host(`nginx2.traefik.kb`)"
- "traefik.http.routers.nginx2.entrypoints=web"
- "traefik.http.routers.nginx2.service=nginx2"
- "traefik.http.services.nginx2.loadbalancer.server.port=80"
I use this stack in docker swarm. My problem is when I try to reach nginx.traefik.kb/ng and i get 404 from nginx. With the whoami image and the url whoami.traefik.kb/who i dont have any problem and with nginx2.traefik.kb neither...
I only have this config file, no traefik.yml or so.
Any ideas?? Thanks!!
Upvotes: 0
Views: 2697
Reputation: 113
SOLVED!
Adding this:
- "traefik.http.middlewares.nginx-prefix.stripprefix.prefixes=/ng"
- "traefik.http.routers.nginx.middlewares=nginx-prefix"
With this I cant go to http://example.com/ng and get nginx running
Upvotes: 7