-
Notifications
You must be signed in to change notification settings - Fork 0
/
traefik with letsencrypt docker setup
96 lines (78 loc) · 2.43 KB
/
traefik with letsencrypt docker setup
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
1. Create a network for traefik to interact with other guests on
"docker network create web"
2. Make a working directory and cd to it, I chose "mkdir -p /srv/traefik" and chowned it
3. create a docker-compose.yml, note that traefik.toml is located in my cifs mount
version: '3'
services:
reverse-proxy:
image: traefik
command: --api --docker
restart: always
ports:
- 8080:8080
- 80:80
- 443:443
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /srv/datalink/Traefik/traefik.toml:/traefik.toml
- /srv/traefik/acme.json:/acme.json
container_name: traefik
labels:
- "traefik.enable=false"
networks:
default:
external:
name: "web"
4. Create acme.json and chmod 0600
5. Create traefik.toml and put in following config
debug = false
logLevel = "ERROR"
defaultEntryPoints = ["https","http"]
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[retry]
[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "mydomain.tld"
watch = true
exposedByDefault = false
[acme]
email = "my_email@awesome.com"
storage = "acme.json"
entryPoint = "https"
onHostRule = true
[acme.httpChallenge]
entryPoint = "http"
# This next section creates front ends and and backends for my non-docker hosts
[file]
[backends]
[backends.backend1]
[backends.backend1.servers]
[backends.backend1.servers.server0]
url = "http://ip_address:port#"
[backends.backend2]
[backends.backend2.servers]
[backends.backend2.servers.server0]
url = "http://ip_address:port#"
[frontends]
[frontends.frontend1]
entryPoints = ["http", "https"]
backend = "backend1"
passHostHeader = true
[frontends.frontend1.routes]
[frontends.frontend1.routes.route0]
rule = "Host:host.domain.tld"
[frontends.frontend2]
entryPoints = ["http", "https"]
backend = "backend2"
passHostHeader = true
[frontends.frontend2.routes]
[frontends.frontend2.routes.route0]
rule = "Host:host.domain.tld"
6. Run docker-compose up -d