Skip to content

Instantly share code, notes, and snippets.

@echicken
Last active May 21, 2024 17:22
Show Gist options
  • Save echicken/5e7484c7220da6889ed2287c94dceb5c to your computer and use it in GitHub Desktop.
Save echicken/5e7484c7220da6889ed2287c94dceb5c to your computer and use it in GitHub Desktop.
ecbbs reverse proxy docker
services:
proxy:
image: nginx:latest
ports:
- 80:80
- 443:443
restart: always
volumes:
- ./nginx/conf.d/:/etc/nginx/conf.d/:ro
- ./certbot/www/:/var/www/certbot/:ro
- ./certbot/conf/:/etc/letsencrypt/:ro
certbot:
image: certbot/certbot:latest
volumes:
- ./certbot/www/:/var/www/certbot/:rw
- ./certbot/conf/:/etc/letsencrypt/:rw
To make certbot grab a cert, replace [domain-name] with the domain in question:
docker-compose run --rm certbot certonly --webroot --webroot-path /var/www/certbot/ --dry-run -d [domain-name]
If that looks good, then do it again without the --dry-run option.
And to renew certificates, add a cron job on the host like so:
59 11 * * * /sbbs/reverse-proxy/renew.sh
#!/bin/sh
cd /sbbs/reverse-proxy
docker-compose run --rm certbot renew >> /sbbs/reverse-proxy/certbot.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment