Skip to content

Add SSL support

https://github.com/wodby/docker4drupal/issues/50#issuecomment-291749340,

https://github.com/wodby/docker4drupal/issues/50#issuecomment-307755705:

traefik:
    image: traefik
    restart: unless-stopped
    command: -c /dev/null --web --docker --logLevel=INFO --defaultEntryPoints='https' --entryPoints="Name:https Address::443 TLS:/certs/cert.pem,/certs/key.pem" --entryPoints="Name:http Address::80 Redirect.EntryPoint:https"
    ports:
      - '80:80'
      - '443:443'
      - '8080:8080'
    volumes:
      - ./certs:/certs/
      - /var/run/docker.sock:/var/run/docker.sock

The decisive parts are the command line and the reference to the certificate files, included via volume share.

However I removed the redirect from http to https, as this allows to access projects with both. As some projects may require https and others may not:

command: -c /dev/null --web --docker --logLevel=DEBUG --defaultEntryPoints="https" --defaultEntryPoints="http" --entryPoints="Name:https Address::443 TLS:/certs/cert.pem,/certs/key.pem" --entryPoints="Name:http Address::80"

Edited by richardpapp