From 6a164ab40da550582624da1b392fdeeb1e50e5b3 Mon Sep 17 00:00:00 2001 From: constantprojects Date: Tue, 24 Feb 2026 09:11:08 -0700 Subject: [PATCH] Clean stale certbot data before SSL acquisition attempt If a previous certbot run created live/archive/renewal dirs but failed to complete, the next attempt would choke on the existing 'live directory'. Now cleans these before each attempt. Co-Authored-By: Claude Opus 4.6 --- nginx/entrypoint.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nginx/entrypoint.sh b/nginx/entrypoint.sh index 94be9d2..03b2f7e 100755 --- a/nginx/entrypoint.sh +++ b/nginx/entrypoint.sh @@ -47,6 +47,11 @@ else echo "Requesting Let's Encrypt certificate for ${DOMAIN}..." + # Clean stale certbot data from any previous failed attempt + rm -rf "/etc/letsencrypt/live/${DOMAIN}" \ + "/etc/letsencrypt/archive/${DOMAIN}" \ + "/etc/letsencrypt/renewal/${DOMAIN}.conf" 2>/dev/null || true + # Attempt certificate acquisition if certbot certonly --webroot \ -w /var/www/certbot \