Let's Encrypt is a free https certification signing organization. Followed these steps here to install letsencrypt certbot.
The command I used to create a certificate for this site and the other sub-domains was:
This created the certificate.
Now test the renewal process by typing:
It worked perfectly.
NOTE: to renew a single certificate you can do
Now setting up the cron-job to do automatic renewals.
Add the following line in crontab:
where the content of restartNginX.sh is:
Note that the full path of nginx.pid is used. I did not have full path for sometime and the restart used to fail and I used to get certificate expired on my site periodically.
https://acme-v01.api.letsencrypt.org/directory to https://acme-v02.api.letsencrypt.org/directory
here. Added the following lines to the nginx configuration file for this site:
After setting the cronjob the certificate renew happens but the server should be restarted in order for it to use the new certificates so also add the restart server command in the crontab.