Last active
December 8, 2024 13:30
-
-
Save maxkagamine/5b6c34db6045d6413db3b333d6d2bae2 to your computer and use it in GitHub Desktop.
Guide to running an nginx reverse proxy on Unraid with a Let's Encrypt wildcard cert, using the official nginx and certbot Docker images.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#description=Updates the web gui ssl cert if it's been renewed. | |
set -eo pipefail | |
CERTS_DIR=/mnt/user/appdata/nginx-certbot/certs/live/default | |
BUNDLE=/boot/config/ssl/certs/certificate_bundle.pem | |
new_bundle=$(cat \ | |
"$CERTS_DIR/cert.pem" \ | |
"$CERTS_DIR/fullchain.pem" \ | |
"$CERTS_DIR/privkey.pem") | |
[[ -f $BUNDLE ]] && old_bundle=$(cat "$BUNDLE") | |
if [[ "$old_bundle" != "$new_bundle" ]]; then | |
echo 'Updating SSL cert' | |
cat <<<"$new_bundle" >"$BUNDLE" | |
/etc/rc.d/rc.nginx restart | |
else | |
echo 'Nothing to do' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment