1 min read
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
- Ubuntu server
- Python
- Nginx
- Nginx minimal website
- Nginx SSL website
- Install Let’s Encrypt and create a free SSL certificate
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-renew
script.
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
Categories: Web serverTags: certificate , letsencrypt , nginx , ssl , ubuntu
Edit this page
Show statistic for this page