Letsencrypt Nginx Ubuntu 16.04

Let’s Encrypt Nginx on Ubuntu 16.04

What is Let’s Encrypt?

Let’s Encrypt is an open source Certificate Authority (CA) for issuing free SSL/TLS certificates. SSL/TLS certificates are used to encrypt communications between a web server and a web browser. They can also be used by websites to authenticate their identity, providing trust in customers that they are dealing with the correct website. Having an SSL/TLS certificate is one of the most important security measures a website can implement. Let’s Encrypt provides a simpler and more secure solution for websites to make sure their communications remain private and secure.

What is Nginx?

Nginx (pronounced “engine x”) is an open source web server and reverse proxy software. It’s lightweight, efficient, and it has a large community of developers who are constantly making improvements. In addition to its web server capabilities, Nginx can also act as a mail proxy, load balancer, caching proxy, and more. It is often deployed alongside web applications to provide an extra layer of security and performance.

Prerequisites for Installing Let’s Encrypt on Nginx in Ubuntu 16.04

Before you begin, make sure you have the following configured and ready:

  1. A domain name pointed at a server running Ubuntu 16.04.
  2. A non-root user with sudo privileges.
  3. Nginx installed and configured.

Step 1 — Installing Certbot

The easiest way to install Let’s Encrypt certificates in Nginx on Ubuntu 16.04 is to use the Certbot client. Certbot is an automated client developed by the Electronic Frontier Foundation (EFF). It can be used to generate SSL certificates and then automatically configure Nginx to use them.

Certbot is not available in Ubuntu’s default package repositories. To install it, we first need to add the repository provided by EFF. This repository is managed by a package called software-properties-common. To install it, run the following command:

sudo add-apt-repository ppa:certbot/certbot

Once the repository is added to our system, we can install Certbot. To do so, run the following commands to update the local package index and then install Certbot and all of its dependencies:

sudo apt-get update
sudo apt-get install certbot python-certbot-nginx

Step 2 — Generating SSL Certificates

Once Certbot is installed, we can use it to generate SSL certificates for our domain. To do so, run the following command, replacing example.com with your domain name:

sudo certbot --nginx -d example.com

Certbot will prompt you to enter your email address and agree to the terms of service. After you answer these questions, Certbot will use the Nginx configuration you provided to generate a certificate. Once the certificate is generated, Certbot will automatically configure Nginx to use it.

Step 3 — Configuring Renewal

Let’s Encrypt certificates are only valid for 90 days. This means that they must be renewed periodically. To do this, we can create a cron job that will run the renewal command automatically. To create the job, open your crontab file with the following command:

sudo crontab -e

At the bottom of the file, add this line:

30 2 * * 1 certbot renew --quiet

This will run the renewal command every Monday at 2:30 am. This will ensure that your certificates are renewed before they expire.


In this article, we’ve shown you how to install Let’s Encrypt certificates in Nginx on Ubuntu 16.04. Let’s Encrypt provides an easy and secure way to protect your website with HTTPS encryption. We hope you’ve found this tutorial useful.

Frequently Asked Questions (FAQs)

  • Q: How often do Let’s Encrypt certificates need to be renewed?
    A: Let’s Encrypt certificates are only valid for 90 days and must be renewed every 90 days.
  • Q: Is Nginx suitable for high traffic websites?
    A: Yes, Nginx is suitable for high traffic websites because of its performance and scalability.
  • Q: Is it possible to use Let’s Encrypt for commercial websites?
    A: Yes, Let’s Encrypt can be used on commercial websites.

Thank you for reading this article! Be sure to read other articles about web development.

Leave a Reply

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