fix: nginx autoreload

This commit is contained in:
Mohamed Marrouchi 2024-09-13 11:07:41 +01:00
parent 6955a09536
commit 9989c1b199
2 changed files with 7 additions and 1 deletions

View File

@ -8,7 +8,7 @@ services:
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
- ./nginx/certbot/conf:/etc/letsencrypt - ./nginx/certbot/conf:/etc/letsencrypt
- ./nginx/certbot/www:/var/www/certbot - ./nginx/certbot/www:/var/www/certbot
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'" - ./nginx/99-autoreload.sh:/docker-entrypoint.d/99-autoreload.sh
certbot: certbot:
image: certbot/certbot image: certbot/certbot

View File

@ -0,0 +1,6 @@
#!/bin/sh
while :; do
# Optional: Instead of sleep, detect config changes and only reload if necessary.
sleep 6h
nginx -t && nginx -s reload
done &