Nginx Certbot Docker

nginx + certbot + docker-compose

Quick Intro: Generating SSLs using docker, docker-compose, Nginx & certbot.

Note: In a single certbot command it always generates a single certificate for all the domains listed inside.

# You may specify multiple domains with -d and obtain and
# install different certificates by running Certbot multiple times:
here is the doc

Here is the docker-compose file. Look at the command given to certbot that has multiple subdomains for which we need to generate the certificates for.

→ Use the below nginx.conf file to generate the certs:

→ Add the server blocks once generated as to the above conf file to use the SSLs and also the redirect.

→ Renew Certs

cat <(crontab -l) <(echo “@monthly docker-compose run — rm certbot renew”) | crontab -

Find my other articles @ my publication: ThinkSpecial

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store