forked from openscript/traefik-nginx-docker-compose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
55 lines (52 loc) · 2.08 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
version: "3.8"
networks:
proxy:
name: proxy
volumes:
letsencrypt:
driver: local
services:
traefik:
image: traefik
container_name: traefik
networks:
- proxy
ports:
- "80:80"
- "443:443"
labels:
- "traefik.enable=true"
- "traefik.http.routers.dashboard-https.rule=Host(`proxy.example.com`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))"
- "traefik.http.routers.dashboard-https.entrypoints=https"
- "traefik.http.routers.dashboard-https.tls.certresolver=defaultResolver"
- "traefik.http.routers.dashboard-https.service=api@internal"
- "traefik.http.routers.dashboard-https.middlewares=auth"
- "traefik.http.middlewares.auth.basicauth.users=user:password"
- "traefik.http.routers.dashboard-http.rule=Host(`proxy.example.com`)"
- "traefik.http.routers.dashboard-http.entrypoints=http"
- "traefik.http.routers.dashboard-http.middlewares=https_redirect"
- "traefik.http.middlewares.https_redirect.redirectscheme.scheme=https"
- "traefik.http.middlewares.https_redirect.redirectscheme.permanent=true"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./traefik.yml:/traefik.yml
- letsencrypt:/letsencrypt
nginx:
image: nginx:alpine
container_name: nginx
networks:
- proxy
volumes:
- "./website:/usr/share/nginx/html:ro"
- "./nginx.conf:/etc/nginx/nginx.conf:ro"
labels:
- "traefik.enable=true"
- "traefik.http.middlewares.nginx-redirect-https.redirectscheme.scheme=https"
- "traefik.http.routers.nginx-http.middlewares=nginx-redirect-https"
- "traefik.http.routers.nginx-http.rule=Host(`example.com`)"
- "traefik.http.routers.nginx-http.entrypoints=http"
- "traefik.http.routers.nginx-https.rule=Host(`example.com`)"
- "traefik.http.routers.nginx-https.entrypoints=https"
- "traefik.http.routers.nginx-https.tls.certresolver=defaultResolver"
- "traefik.http.routers.nginx-https-service=nginx-http-service"
- "traefik.http.services.nginx-http-service.loadbalancer.server.port=80"