Last active
September 6, 2017 07:53
-
-
Save geerteltink/0bf3a74089969b93fcb59861cdef0750 to your computer and use it in GitHub Desktop.
Let’s Encrypt cronjob script
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 | |
# | |
SERVER="https://acme-v01.api.letsencrypt.org/directory" | |
EMAIL="[email protected]" | |
DOMAINS=("example.com" "example2.com" "example3.com") | |
WEBROOT=/tmp/letsencrypt/www | |
for DOMAIN in "${DOMAINS[@]}" | |
do | |
mkdir -p $WEBROOT | |
letsencrypt certonly \ | |
--authenticator webroot --webroot-path $WEBROOT \ | |
-d $DOMAIN -d www.$DOMAIN \ | |
--server $SERVER --email $EMAIL \ | |
--agree-tos --renew-by-default | |
done | |
systemctl restart nginx |
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
server { | |
listen 80; | |
listen [::]:80; | |
server_name example.com www.example.com; | |
location /.well-known/acme-challenge { | |
root /tmp/letsencrypt/www; | |
} | |
location / { | |
return 301 https://example.com$request_uri; | |
} | |
} | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment