Previously we have discussed HTTPS secures the communication between visitors and web servers. We will show you how to use Certbot to obtain a free SSL certificate for Nginx on Ubuntu and set up your certificate to renew automatically.


  1. your server is Ubuntu,
  2. a website with registered domain name, e.g, and
  3. your webserver is Nginx

Step 1:

Add the PPA (Personal Package Archives) to your list of repositories and install Certbot

$ sudo apt-get update 
$ sudo apt-get install software-properties-common 
$ sudo add-apt-repository ppa:certbot/certbot 
$ sudo apt-get update 
$ sudo apt-get install python-certbot-nginx

Step 2:

Obtaining an SSL CertificateObtaining an SSL Certificate

sudo certbot --nginx -d -d

This runs certbot with the –nginx plugin, using -d to specify the domain. Running this command will get a certificate for you and have Certbot edit your Nginx configuration automatically to serve it.

Step 3:

Renew certificate automatically

The Certbot packages on your system come with a cron job that will renew your certificates automatically before they expire. Since Let’s Encrypt certificates last for 90 days, it’s highly advisable to take advantage of this feature. You can test automatic renewal for your certificates by running this command:

$ sudo certbot renew --dry-run

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.