Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abenevaut/4eb3b54a84fd7e9f9a80f60d8a990fce to your computer and use it in GitHub Desktop.
Save abenevaut/4eb3b54a84fd7e9f9a80f60d8a990fce to your computer and use it in GitHub Desktop.
How to setup a basic Traefik reverse proxy on Windows ?
# C:\Windows\System32\drivers\etc\hosts
127.0.0.1 traefik.local webapp.local
version: '3'
networks:
router_network:
driver: overlay
external: true
name: local_router_network
volumes:
traefik_data:
#
# docker-compose -f traefik-compose.yml up -d
#
services:
traefik:
image: traefik:saintmarcelin
labels:
- "traefik.enable=true"
- "traefik.http.routers.api.entrypoints=web"
- "traefik.http.routers.api.rule=Host(`traefik.local`)"
- "traefik.http.routers.api.service=api@internal"
command:
- --api.dashboard=true
- --log.level=DEBUG
- --providers.docker
- --entryPoints.web.address=:80
- --entryPoints.web.forwardedHeaders.insecure
- --entryPoints.websecure.address=:443
- --entryPoints.websecure.forwardedHeaders.insecure
ports:
- 80:80
- 443:443
extra_hosts:
- host.docker.internal:host-gateway
networks:
- router_network
volumes:
- //var/run/docker.sock:/var/run/docker.sock:ro
- traefik_data:/certificates
version: '3'
networks:
router_network: # Network alias in this docker-compose.yml
driver: overlay
external: true
name: local_router_network
#
# docker-compose -f webapp-compose.yml up -d
#
services:
webapp:
image: nginx:latest
labels:
- "traefik.enable=true"
- "traefik.docker.network=router_network"
- "traefik.http.routers.webapp.entrypoints=websecure" # web (http) or websecure (https)
- "traefik.http.routers.webapp.tls=true"
- "traefik.http.routers.webapp.rule=Host(`webapp.local`)"
- "traefik.http.routers.webapp.priority=1"
- "traefik.http.services.webapp.loadbalancer.server.port=80"
networks:
- router_network
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment