Linux: Automatically renew your certs for a wordpress site using letsencrypt

If you want to automatically renew your certs then the easiest way is to setup a cron just to call letsencrypt periodically. Below is an example cron job:

First create the bash script to renew the certificate

$ pwd
$ sudo nano

Now enter the script in the following format into nano:


sudo /opt/bitnami/ stop apache
sudo /opt/bitnami/letsencrypt/lego --path /opt/bitnami/letsencrypt --email="" --http --http-timeout 30 --http.webroot /opt/bitnami/apps/letsencrypt renew --days 90
sudo /opt/bitnami/ start apache

Now edit the crontab to run the renew script:

$ crontab -e
0 0 * * * sudo /home/bitnami/ 2> /dev/null

Leave a Reply

Your email address will not be published. Required fields are marked *