Renewing and Reinstalling SSL Certificate for WordPress Site

I let it expire!

Yes, I did not pay too much attention to my email account and did not realize that the site certificate had already expired. So for a long long time any visitors to my WordPress website were getting some “unsecure website” errors.

Renewing the certificate

So first I tried by running the ” /opt/bitnami/letsencrypt/scripts/generate-certificate.sh” script, but I was getting the following error:

It seems there is a valid certificate in the web server configuration folder. Please renew that certificate or generate new ones manually

So first I stopped the apache server:

sudo /opt/bitnami/ctlscript.sh stop apache

Then run the lego script:

sudo /opt/bitnami/letsencrypt/lego --email="email@email.com" --domains="site.com" --domains="www.site.com" --path="/opt/bitnami/letsencrypt" --http renew

After this, start the apache server:

sudo /opt/bitnami/ctlscript.sh start apache

This regenerated my certificate. Now I attempted to run the bncert-tool:

sudo /opt/bitnami/bncert-tool

However this marked an error “Removing cron entry”. To resolve this I edited the crontab file to remove any existing lines:
sudo crontab -e -u bitnami

After this, I was able to re-run the bncert-tool to be able to finally reinstall the certificates and have the site securely up and running in https mode.