Setting up Let's Encrypt for multisite

I recommend using Nginx Proxy together with the LetsEncrypt companion container for nginx-proxy. This setup allows me to run many containerized web apps at ports 80 or 443 as well as automatic certificate renewal.

Besides starting both containers the only configuration you need is to add 3 environment variables to a Docker container. Example for Discourse (in /var/discourse/containers/app.yml):

  DISCOURSE_HOSTNAME: 'discourse.mydomain.tld'
  VIRTUAL_HOST: 'discourse.mydomain.tld'
  LETSENCRYPT_HOST: 'discourse.mydomain.tld'
  LETSENCRYPT_EMAIL: 'your_mailbox@mydomain.tld'

Nginx Proxy needs the containers to expose their port to be proxied which you do like this in your app.yml:

expose:
  - "80"   # fwd host port 80   to container port 80 (http)
2 Likes