Skip to content

Instantly share code, notes, and snippets.

Created December 5, 2015 13:31
Show Gist options
  • Save anonymous/19bd96a89808b1ffe646 to your computer and use it in GitHub Desktop.
Save anonymous/19bd96a89808b1ffe646 to your computer and use it in GitHub Desktop.
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
LETSENCRYPT="/usr/local/letsencrypt/letsencrypt-auto"
DOMAINS="home.savage.hk,couchpotato.home.savage.hk,cp.home.savage.hk,sonarr.home.savage.hk,sonar.home.savage.hk,synology.home.savage.hk,nas.home.savage.hk"
#DOMAINS="home.savage.hk,couchpotato.home.savage.hk,sonarr.home.savage.hk"
EMAIL="andy@bluewire.net.nz"
WEBROOT_PATH="/tmp/letsencrypt-auto"
AUTH_STYLE="standalone"
#AUTH_STYLE="webroot"
#-a "$AUTH_STYLE"
#ACCOUNT_ID="287c71a4caed3710500caee7c16ab63c" # Live ID
ACCOUNT_ID="6d2896f8366b1b6dfd482e31f42a56dd" # Staging ID
STANDALONE_PORT=5599
LE_SERVER="https://acme-staging.api.letsencrypt.org/directory" # Staging Server
#LE_SERVER="https://acme-v01.api.letsencrypt.org/directory" # Live Server
#mkdir -p "$WEBROOT_PATH"
#chown -R www-data:www-data "$WEBROOT_PATH/.well-knwn"
sudo -H "$LETSENCRYPT" certonly \
--account "$ACCOUNT_ID" \
--webroot \
--webroot-path "$WEBROOT_PATH" \
--email "$EMAIL" \
--domains "$DOMAINS" \
--server "$LE_SERVER" \
--agree-tos \
--renew-by-default \
--text \
--standalone-supported-challenges tls-sni-01 \
--tls-sni-01-port $STANDALONE_PORT \
&& "/etc/init.d/nginx" reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment