Skip to content

Commit

Permalink
Test the nginx configuration before reloading. This avoids crashing t…
Browse files Browse the repository at this point in the history
…he container if there are configuration errors.
  • Loading branch information
stefansundin committed Sep 22, 2023
1 parent 5052491 commit 339c1a4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/scripts/run_certbot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,5 +169,11 @@ done
# did indeed get certificates for.
auto_enable_configs

# Make sure the Nginx configs are valid.
if ! nginx -t; then
error "Nginx configuration is invalid, skipped reloading. Check the logs for details."
exit 0
fi

# Finally, tell Nginx to reload the configs.
nginx -s reload
6 changes: 6 additions & 0 deletions src/scripts/run_local_ca.sh
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,11 @@ done
# did indeed succeed with.
auto_enable_configs

# Make sure the Nginx configs are valid.
if ! nginx -t; then
error "Nginx configuration is invalid, skipped reloading. Check the logs for details."
exit 0
fi

# Finally, tell Nginx to reload the configs.
nginx -s reload

0 comments on commit 339c1a4

Please sign in to comment.