Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save onionstand/d34b79c8de94d0e5b8b81bf2b349fd63 to your computer and use it in GitHub Desktop.
Save onionstand/d34b79c8de94d0e5b8b81bf2b349fd63 to your computer and use it in GitHub Desktop.
Install and configure LetsEncrypt on Ubuntu Server 14.04 & 16.04 (Apache)
#!/bin/bash
# https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-14-04
# Download the Let’s Encrypt Client
cd /usr/local/sbin
sudo wget https://dl.eff.org/certbot-auto
sudo chmod a+x /usr/local/sbin/certbot-auto
# Set Up the SSL Certificate
certbot-auto --apache -d example.com
# Remove above and uncomment below if you want to include sub domains
#certbot-auto --apache -d example.com -d www.example.com
# Creating a new Cronjob when no Cron jobs exist while running crontab -e as root?
echo "30 2 * * 1 /usr/local/sbin/certbot-auto renew > /var/log/le-renew.log" >> /var/spool/cron/crontabs/root
chown root:root /var/spool/cron/crontabs/root
chmod 600 /var/spool/cron/crontabs/root
# Remove above and uncomment below if you want to append to an existing list of Cron jobs, i.e. Cron jobs exist when running crontab -e?
#echo "30 2 * * 1 /usr/local/sbin/certbot-auto renew >> /var/log/le-renew.log" >> /var/spool/cron/crontabs/root
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment