Skip to content

Instantly share code, notes, and snippets.

@huntie
Last active March 1, 2018 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save huntie/46271d0f30ba2540a6f72b0d38ae7b33 to your computer and use it in GitHub Desktop.
Save huntie/46271d0f30ba2540a6f72b0d38ae7b33 to your computer and use it in GitHub Desktop.
Issue and automate renewal of SSL certificates with Let's Encrypt using Certbot

Install Certbot and register Let's Encrypt account:

add-apt-repository ppa:certbot/certbot
apt update
apt install certbot
certbot register

Issue new SSL certificates for each host:

certbot certonly --webroot -w /var/www/alexhunt.io/ -d alexhunt.io -d www.alexhunt.io

Add a new Cron entry for renewals:

@daily certbot renew --post-hook "nginx -s reload" 2>> /var/log/certbot.log

certbot renew references all pre-obtained certificates and will skip any with more than 30 days remaining before expiry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment