Created
August 12, 2023 18:40
-
-
Save bardic/6f07e5c19313b13d6e0b6e455adfa3e5 to your computer and use it in GitHub Desktop.
How I use docker and a simple shell script to renew my ssl certs. Nginx docker and site.conf example of how certs are processed and saved
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
#!/bin/bash | |
docker-compose -f ../certbot/docker-compose.yml --env-file ../certbot/openbracket.ca.env up | |
docker-compose -f ../certbot/docker-compose.yml --env-file ../certbot/pass.openbracket.ca.env up | |
docker-compose -f ../certbot/docker-compose.yml --env-file ../certbot/social.openbracket.ca.env up | |
docker-compose -f ../certbot/docker-compose.yml --env-file ../certbot/git.openbracket.ca.env up | |
docker-compose -f ../certbot/docker-compose.yml --env-file ../certbot/design.openbracket.ca.env up |
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
version: '3.5' | |
services: | |
certbot: | |
image: certbot/certbot:latest | |
container_name: certbot | |
command: > | |
certonly --webroot --noninteractive --agree-tos | |
--webroot-path=/var/www/certbot | |
--preferred-challenges http | |
--email $EMAIL | |
-d $DOMAIN | |
--dry-run | |
volumes: | |
- ./etc/letsencrypt:/etc/letsencrypt | |
- ./www:/var/www/certbot | |
networks: | |
- openbracket | |
networks: | |
openbracket: | |
name: openbracket | |
external: true |
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
server { | |
listen 80; | |
server_name openbracket.ca; | |
location /.well-known/acme-challenge/ { | |
root /var/www/certbot; | |
} | |
location / { | |
return 301 https://$server_name$request_uri; | |
} | |
} |
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
version: '3.5' | |
services: | |
nginx: | |
image: nginx:latest | |
container_name: nginx | |
restart: always | |
ports: | |
- '80:80' | |
- '443:443' | |
volumes: | |
- ../certbot/etc/letsencrypt:/etc/letsencrypt | |
- ../certbot/www:/var/www/certbot | |
- ./etc/nginx:/etc/nginx | |
- ./static:/var/www | |
networks: | |
- openbracket | |
networks: | |
openbracket: | |
name: openbracket | |
external: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment