Setup Traefik as reverse proxy
February 25, 2019
Setup traefik
$ mkdir -p /srv/docker/traefik && cd /srv/docker/traefik
version: '2'
services:
traefik:
image: traefik
restart: always
ports:
- "80:80"
- "443:443"
networks:
- web
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./acme.json:/acme.json
- ./traefik.toml:/traefik.toml
- ./logs:/logs
networks:
web:
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 = "example.com"
watch = true
exposedByDefault = false
[acme]
email = "email@example.com"
storage = "acme.json"
onDemand = true
caServer = "https://acme-v01.api.letsencrypt.org/directory"
entryPoint = "https"
[acme.httpChallenge]
entryPoint = "http"
[accessLog]
filePath = "/logs/access.log"
[traefikLog]
filePath = "/logs/traefik.log"
$ touch acme.json && chmod 600 acme.json
DONE!!