Skip to content

Instantly share code, notes, and snippets.

@lsde
Created May 25, 2020 09:17
Show Gist options
  • Save lsde/fae260c38e8ffe70e4f936d23cc0040d to your computer and use it in GitHub Desktop.
Save lsde/fae260c38e8ffe70e4f936d23cc0040d to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
if [ -z "$1" ]; then
echo "usage: $0 [domain]"
exit 1
fi
source /root/.acme.sh/acme.sh.env
MAIN_DOMAIN=$1
DOMAINS=$@
CERTPATH="/etc/nginx/ssl/$MAIN_DOMAIN"
if [ ! -d "$CERTPATH" ]; then
mkdir -p $CERTPATH
fi
for DOMAIN in $DOMAINS; do
PARAMS="$PARAMS -d $DOMAIN"
done
/root/.acme.sh/acme.sh --issue $PARAMS -w /var/www/html
/root/.acme.sh/acme.sh --installcert -d $MAIN_DOMAIN --fullchainpath $CERTPATH/cert.pem --keypath $CERTPATH/key.pem --reloadcmd "systemctl reload nginx"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment