Installing Let’s Encrypt Free SSL/TLS Certificate on Nginx

Want to encrypt traffic to your website or blog on Nginx using SSL/TLS certificate for free? Apparently using SSL/TLS on your websites is very important to Google and other search engines. This brief tutorial is going to show students and new users how to use Let’s Encrypt free SSL/TLS certificates to encrypt traffic to your websites running on Nginx webservers

We currently use Let’s Encrypt certificates on all our websites and blogs. They’re free and work pretty much like any other certificates from other certificate providers.

When you want to install and use Let’s Encrypt certificates for your websites running Nginx, continue with the steps below:

Step 1: Installing Let’s Encrypt Certificate Package

Step one of this is to install Let’s Encrypt packages on the Ubuntu server. This can be done many ways. A quicker way is to add the PPA below and install the packages from there.

sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:certbot/certbot

Step 2: Installing the packages for Nginx

Now that the PPA is added, run the commands below to install the Let’s Encrypt packages designed for Nginx webserver settings.

sudo apt update
sudo apt install python-certbot-nginx

Step 3: Installing a Certificate

After installing Let’s Encrypt package above, run the commands below to create a new certificate for the domain you which to protect. When you run the commands below, it will prompt you with series of questions and prompts.
Use the guide below to answer.

sudo certbot --nginx

The commands above will help you install Let’s Encrypt certificates for websites running on Nginx webservers.

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices) (Enter 'c' to

Please read the Terms of Service at You must agree
in order to register with the ACME server at
(A)gree/(C)ancel: A

Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about EFF and
our work to encrypt the web, protect its users and defend digital rights.
(Y)es/(N)o: N

Which names would you like to activate HTTPS for?

Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 1
Obtaining a new certificate
Performing the following challenges:
tls-sni-01 challenge for
Waiting for verification...
Cleaning up challenges
Deployed Certificate to VirtualHost /etc/nginx/sites-enabled/ for set([''])

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
The appropriate server block is already redirecting traffic. To enable redirect anyway, uncomment the redirect lines in /etc/nginx/sites-enabled/

Congratulations! You have successfully enabled

You should test your configuration at:

- Congratulations! Your certificate and chain have been saved at:
Your key file has been saved at:
Your cert will expire on 2017-11-18. To obtain a new or tweaked
version of this certificate in the future, simply run certbot again
with the "certonly" option. To non-interactively renew *all* of
your certificates, run "certbot renew"
- Your account credentials have been saved in your Certbot
configuration directory at /etc/letsencrypt. You should make a
secure backup of this folder now. This configuration directory will
also contain certificates and private keys obtained by Certbot so
making regular backups of this folder is ideal.
- If you like Certbot, please consider supporting our work by:

Donating to ISRG / Let's Encrypt:
Donating to EFF:

Done.. if everything goes as planned, the domain you selected should be protected suing Let’s Encrypt SSL/TLS.

Step 4: Renewing the Certificates

Let’s Encrypt certificates expire every 90 days or less. You may have to renew everytime before they expire. To renew, run the commands below

Do a try run first.

sudo certbot renew --dry-run

Then run the commands below to renew the certificate for another 90 days.

certbot renew

To automate this process, edit the crontab and add the line below.

sudo crontab -e

0 4 15 * * /usr/bin/certbot renew


You may also like the post below:

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.