Configure Let’s Encrypt auto renewal for certificates

This post is part of my Your own Virtual Private Server hosting solution project.
Get the latest version of this article here: https://gist.github.com/ddce334cd8ab21a40941.

Introduction

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.

Requirements

Installation

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

Source

Official Let’s Encrypt client documentation – Renewal

Leave a Reply