This solution uses Docker and docker-compose to automate getting the SSL certifications for your website with Let's Encrypt.

Prerequisites:

  • Git
  • Docker
  • docker-compose

Ok, let's get started.


Clone the repo with the automation scripts

git clone https://github.com/gasparandr/letsencrypt-docker.git

Run the init script with your base domain name (e.g. example.com)

./init.sh example.com

Execute a testrun to make sure your configurations are correct (provide all your target domains)

./testrun.sh example.com www.example.com api.example.com blog.example.com

Insert your own email into the liverun script to get notified if your certificates are about the expire

You can use nano, vim, or any other editor to make this change.

vim liverun.sh

change this line of code with your own email:

--email you@youremail.com --agree-tos --no-eff-email \

Execute the liverun with all your target domains as arguments

./liverun.sh example.com www.example.com api.example.com blog.example.com

BOOM. That's it.

BONUS: Get information about your certificates using the information script

./information.sh

BONUS: You can automate your cert renewal by executing the automate-renewal script

./automate-renewal.sh

BONUS: Execute the dhparam script to generate your dhparam.pem

./dhparam

You can find your certs here:

/docker-volumes/dh-param/dhparam-2048.pem

/docker-volumes/etc/letsencrypt/live/{YOUR_DOMAIN}/fullchain.pem

/docker-volumes/etc/letsencrypt/live/{YOUR_DOMAIN}/privkey.pem