Skip to content

Instantly share code, notes, and snippets.

  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Configure Lets Encrypt auto renewal for certificates #Markdown #OpenSSL

This post is part of my Your own Virtual Private Server hosting solution project.
Get the latest version of this article here:


Let’s Encrypt is a free, automated, and open certificate authority (CA), run for the public’s benefit. So far it works well and makes it easy to obtain a free certificate. Now the created certificates will expire withing 90 days. This post will show you how you can auto renew these certificates before they expire.



Create a new bash script and it to the monthly cron folder for sheduling.

cd /etc/cron.monthly/
sudo vi letsencrypt-renew
sudo chmod +x letsencrypt-renew

Add the following code to the letsencrypt-renewscript.

cd /usr/local/src/letsencrypt
sudo service nginx stop
sudo -H ./letsencrypt-auto renew
sudo service nginx start

Now run the script and check if it succeeds.

sudo ./letsencrypt-renew


Official Let's Encrypt client documentation - Renewal

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