From 6551d5f06960412df8ed4275408cdcf4d6408eff Mon Sep 17 00:00:00 2001 From: Felix Freeman Date: Thu, 26 Aug 2021 13:26:35 -0400 Subject: [PATCH] Fix: Don't break certbot-nginx by leaving a temporarily broken nginx config --- nginx.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/nginx.sh b/nginx.sh index 0282544..0e81a5d 100755 --- a/nginx.sh +++ b/nginx.sh @@ -14,6 +14,14 @@ apk add nginx rc-update add nginx rc-service nginx start +if [ "$ENVIRONMENT" = 'production' ]; then + # Certbot + echo "Installing Let's Encrypt certificate" + apk add certbot-nginx + certbot certonly --nginx --agree-tos -m "$ADMIN_EMAIL" --no-eff-email \ + -d "$DECIDIM_DOMAIN" +fi + echo "Setting up $DECIDIM_DOMAIN on Nginx" cat << EOF > "/etc/nginx/http.d/$DECIDIM_DOMAIN.conf" server { @@ -38,11 +46,6 @@ EOF if [ "$ENVIRONMENT" = 'production' ]; then # Certbot - echo "Installing Let's Encrypt certificate" - apk add certbot-nginx - certbot certonly --nginx --agree-tos -m "$ADMIN_EMAIL" --no-eff-email \ - -d "$DECIDIM_DOMAIN" - cat << EOF >> "/etc/nginx/http.d/$DECIDIM_DOMAIN.conf" ssl_certificate /etc/letsencrypt/live/$DECIDIM_DOMAIN/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/$DECIDIM_DOMAIN/privkey.pem; -- 2.45.2