Created
July 19, 2021 22:18
-
-
Save jordancrawfordnz/822943aa00d7a46c2c2d3fa85ba6d83b to your computer and use it in GitHub Desktop.
Docker Compose example for auto renewing certs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I use this as my most recent solution to the problems described in: | |
# https://jordancrawford.kiwi/home-server-without-portforward | |
# This is an excerpt. | |
# To access LetsEncrypt Manager commands, use docker-compose run --rm letsencrypt <command>. | |
# To setup DHParams, use: https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html openssl dhparam -out dhparam.pem 4096 | |
version: '2' | |
services: | |
nginx: | |
container_name: nginx | |
image: nginx | |
ports: | |
- 80:80 | |
- 443:443 | |
restart: always | |
volumes: | |
- ~/services/letsencrypt/data:/ssl | |
- ~/services/letsencrypt/www:/acme-challenge | |
- ./nginx-proxy:/etc/nginx/conf.d | |
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'" | |
certbot: | |
container_name: certbot | |
image: certbot/certbot | |
volumes: | |
- ~/services/letsencrypt/data:/etc/letsencrypt | |
- ~/services/letsencrypt/www:/var/www/certbot | |
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'" | |
restart: always |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment