Nginx with Let's Encrypt

Introduction

In this tutorial we will discuss about installing certbot on ubuntu to install Let's Encrypt SSL on to your ubuntu server.

Prerequisites

Before we start you need to make sure you have followings:

  1. Your own domain for example ( www.example.com)
  2. DNS management credentials.
  3. Update A records in DNS, your A records should look like below.
    1.  A --- > www.example.com ---> 103.x.x.x (your public IP)
    2.  A --- > example.com ---> 103.x.x.x (your public IP)

Let's Encrypt can be installed for the subdomain to. I have personally tried that and it was working fine.

In case you want to do it for subdomain your A records should look like below.

    1. A ---> subdomain.example.com --- > 103.x.x.x (your public IP)

Step 1 — Installing Certbot

We will be using Certbot to install Let's Encrypt, Lets start by adding the repository.

First, add the repository:

sudo add-apt-repository ppa:certbot/certbot

Install Certbot’s Nginx package with apt:

sudo apt install python-certbot-nginx

Now Certbot is ready, before we proceed we need to do some configuration on Nginx server default file.

Open the Nginx default website file.

sudo nano /etc/nginx/sites-available/default