Created
September 18, 2019 00:21
-
-
Save VirtuBox/3cafc85a7af297c965d7bead0224cd1b to your computer and use it in GitHub Desktop.
acme.sh setup for WordOps
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
#!/usr/bin/env bash | |
wo_install_acme_sh() { | |
# check if acme.sh is already installed | |
if [ ! -x /etc/letsencrypt/acme.sh ]; then | |
# clone the git repository | |
if [ -d /opt/acme.sh/.git ]; then | |
git -C /opt/acme.sh pull origin master | |
else | |
git clone --depth=50 https://github.com/Neilpang/acme.sh.git /opt/acme.sh -q | |
fi | |
cd /opt/acme.sh || exit 1 | |
# create conf directories | |
mkdir -p /etc/letsencrypt/{config,live,renewal} | |
# install acme.sh | |
./acme.sh --install \ | |
--home /etc/letsencrypt \ | |
--config-home /etc/letsencrypt/config \ | |
--cert-home /etc/letsencrypt/renewal | |
# enable auto-upgrade | |
/etc/letsencrypt/acme.sh --config-home '/etc/letsencrypt/config' --upgrade --auto-upgrade | |
fi | |
# Let's Encrypt .well-known folder setup | |
if [ ! -d /var/www/html/.well-known/acme-challenge ]; then | |
mkdir -p /var/www/html/.well-known/acme-challenge | |
chown -R www-data:www-data /var/www/html /var/www/html/.well-known | |
chmod 750 /var/www/html /var/www/html/.well-known | |
else | |
chmod 750 /var/www/html /var/www/html/.well-known | |
fi | |
} | |
wo_install_acme_sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment