Created
May 25, 2020 09:17
-
-
Save jonassvatos/fae260c38e8ffe70e4f936d23cc0040d to your computer and use it in GitHub Desktop.
This file contains 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 | |
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