Skip to content

Commit

Permalink
Merge pull request #25 from frigi83/dev
Browse files Browse the repository at this point in the history
✨ multiple domains
  • Loading branch information
frigi83 authored Jul 23, 2022
2 parents c116ec7 + 938261f commit 1c712b1
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ All this examples are based on traefik **version 2.x**.
- **Ping**: check the traefik status with an http ping
- **Nextcloud**: personal office online with ONLYOFFICE
- **network segregation**: segment the traffic of containers
- **multiple domains**: multi domain pointing to a single container


### Installing
Expand Down
17 changes: 17 additions & 0 deletions example_multidomain/FileProvider/file-provider.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[tls.options]

[tls.options.default]
minVersion = "VersionTLS12"

cipherSuites = [
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305",
"TLS_AES_128_GCM_SHA256",
"TLS_AES_256_GCM_SHA384",
"TLS_CHACHA20_POLY1305_SHA256"
]

sniStrict = true

[http]
5 changes: 5 additions & 0 deletions example_multidomain/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

See this post https://frigi.ch/en/2022/07/multiple-domains-for-the-same-container-with-traefik/


If you find a problem in this guide or in the configurations files you can open an [issue](https://github.com/frigi83/traefik-examples/issues) on GitHub. Thanks!
72 changes: 72 additions & 0 deletions example_multidomain/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
version: '3.7'

services:

# =============================================================
#
# TRAEFIK - reverse proxy
#
# =============================================================

traefik:
image: traefik:latest
container_name: traefik
command:
# - "--log.level=DEBUG"
- "--api.dashboard=true"
- "--providers.file.directory=/FileProvider/"
- "--providers.file.watch=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.web.http.redirections.entryPoint.to=web-secure"
- "--entrypoints.web.http.redirections.entryPoint.scheme=https"
- "--entrypoints.web-secure.address=:443"
- "--serverstransport.insecureskipverify=true"
- "--certificatesresolvers.certificato.acme.dnschallenge=true"
- "--certificatesresolvers.certificato.acme.dnschallenge.provider=cloudflare"
- "--certificatesresolvers.certificato.acme.dnschallenge.delaybeforecheck=10"
- "--certificatesresolvers.certificato.acme.dnschallenge.resolvers=1.1.1.1:53"
# - "--certificatesresolvers.certificato.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
- "--certificatesresolvers.certificato.acme.email=${ACME_EMAIL}"
- "--certificatesresolvers.certificato.acme.storage=acme.json"
- "--ping=true"
environment:
CF_API_EMAIL: ${CF_API_EMAIL}
CF_API_KEY: ${CF_API_KEY}
CLOUDFLARE_EMAIL: ${CLOUDFLARE_EMAIL}
CLOUDFLARE_API_KEY: ${CLOUDFLARE_API_KEY}
labels:
- "traefik.enable=true"
- "traefik.http.routers.api.rule=Host(`traefik.${DOMAIN}`)"
- "traefik.http.routers.api.entrypoints=web-secure"
- "traefik.http.routers.api.tls.certresolver=certificato"
- "traefik.http.routers.api.tls.domains[0].main=*.${DOMAIN}"
- "traefik.http.routers.api.service=api@internal"
ports:
- 80:80
- 443:443
volumes:
- /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
- /path/to/docker/traefik/acme.json:/acme.json
- /path/to/docker/traefik/FileProvider/:/FileProvider/
restart: always


# =============================================================
#
# WHOAMI
#
# =============================================================

whoami:
image: containous/whoami
container_name: whoami
labels:
- "traefik.enable=true"
- "traefik.http.routers.whoami.rule=Host(`whoami.${DOMAIN}`) || Host(`whoami.traefik-examples.tk`)"
- "traefik.http.routers.whoami.entrypoints=web-secure"
- 'traefik.http.routers.whoami.tls=true'
- "traefik.http.routers.whoami.tls.certresolver=certificato"
- "traefik.http.routers.whoami.tls.domains[0].main=*.${DOMAIN}"
- "traefik.http.routers.whoami.tls.domains[1].main=*.traefik-examples.tk"

0 comments on commit 1c712b1

Please sign in to comment.