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 -