Skip to content

Instantly share code, notes, and snippets.

@dnno
Created October 20, 2023 12:21
Show Gist options
  • Save dnno/d00d194664efe77cd09abdd66ad638f5 to your computer and use it in GitHub Desktop.
Save dnno/d00d194664efe77cd09abdd66ad638f5 to your computer and use it in GitHub Desktop.
nginx docker-compose.yaml
version: '3'
services:
nginx:
image: nginx:1.25.2
container_name: nginx
restart: always
volumes:
- ./conf/nginx.conf:/etc/nginx/nginx.conf
- ./conf/conf.d:/etc/nginx/conf.d
- ./data/certbot/conf:/etc/letsencrypt
- ./data/certbot/www:/var/www/certbot
ports:
- 80:80
- 443:443
networks:
- proxy
- web
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
certbot:
image: certbot/certbot
restart: always
volumes:
- ./data/certbot/conf/:/etc/letsencrypt
- ./data/certbot/www:/var/www/certbot
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
networks:
- web
networks:
proxy:
internal: true
web:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment