Skip to content

Instantly share code, notes, and snippets.

@alexd73
Created March 24, 2020 07:51
Show Gist options
  • Save alexd73/228998ce44fa47d3aca86b457e2b1f4e to your computer and use it in GitHub Desktop.
Save alexd73/228998ce44fa47d3aca86b457e2b1f4e to your computer and use it in GitHub Desktop.
d4d traefik v2 https
nginx:
image: wodby/nginx:$NGINX_TAG
container_name: "${PROJECT_NAME}_nginx"
depends_on:
- php
environment:
NGINX_STATIC_OPEN_FILE_CACHE: "off"
NGINX_ERROR_LOG_LEVEL: debug
NGINX_BACKEND_HOST: php
NGINX_SERVER_ROOT: /var/www/html/web
NGINX_VHOST_PRESET: $NGINX_VHOST_PRESET
# NGINX_DRUPAL_FILE_PROXY_URL: http://example.com
volumes:
- ./:/var/www/html
# For macOS users (https://wodby.com/docs/stacks/drupal/local#docker-for-mac)
# - ./:/var/www/html:cached # User-guided caching
# - docker-sync:/var/www/html # Docker-sync
labels:
- "traefik.enable=true"
- "traefik.http.routers.${PROJECT_NAME}_nginx.rule=Host(`${PROJECT_BASE_URL}`)"
- "traefik.http.routers.${PROJECT_NAME}_nginx.entrypoints=http"
- "traefik.http.middlewares.${PROJECT_NAME}_https_nginx.redirectscheme.scheme=https"
- "traefik.http.routers.${PROJECT_NAME}_https_nginx.rule=Host(`${PROJECT_BASE_URL}`)"
- "traefik.http.routers.${PROJECT_NAME}_https_nginx.entrypoints=https"
- "traefik.http.routers.${PROJECT_NAME}_https_nginx.tls=true"
traefik:
image: traefik:v2.0
container_name: "${PROJECT_NAME}_traefik"
command: --api.insecure=true --providers.docker
# command: -c /dev/null --web --docker --logLevel=DEBUG --defaultEntryPoints='https' --entryPoints="Name:https Address::443 TLS:/certs/api.bayu-bai.docker.localhost.cert,/certs/api.bayu-bai.docker.localhost.key" --entryPoints="Name:http Address::80"
ports:
- '80:80'
- '443:443'
- '8080:8080' # Dashboard
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /etc/localtime:/etc/localtime:ro
- ./traefik.yml:/traefik.yml:ro
- ./traefik.dynamic.yml:/traefik.dynamic.yml:ro
- ./certs:/certs
tls:
stores:
default:
defaultCertificate:
certFile: /certs/api.site.docker.localhost.cert
keyFile: /certs/api.site.docker.localhost.key
certificates:
- certFile: /certs/api.site.docker.localhost.cert
keyFile: /certs/api.site.docker.localhost.key
api:
dashboard: true
log:
level: DEBUG
filePath: "debug.log"
format: txt
accessLog:
filePath: "access.log"
bufferingSize: 100
entryPoints:
http:
address: ":80"
https:
address: ":443"
providers:
file:
filename: /traefik.dynamic.yml
watch: true
docker:
endpoint: "unix:///var/run/docker.sock"
exposedByDefault: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment