How to install an SSL certificate on a NGINX server

After your Certificate is issued by the Certificate Authority, you’re ready to begin installation on your NGINX server.

Category:

DevOps

How to install an SSL certificate on a NGINX server

Harsh Vardhan

Sun Feb 07 2021・2 min read

Keeping your users’ data safe is important in the digital age. People’s entire lives are now online in some way. One of the first things you can do to ensure your users’ safety is to ensure their data is transmitted to you and back securely, and for that, we use SSL. SSL is the tool responsible for HTTPS and the little safe green lock in your browser telling your user that any data they transmit to your site will be done securely.

What You’ll Learn

Securing your Sites with Certbot
Modern web servers with SSL on by default (Nginx)

This post is Designed For

Systems administrators, DevOps engineers, first-time web developers, students.

Prerequisites

Knowledge of how to install packages on a Linux operating system and deploy a website to a server using Nginx, Apache, or Caddy. Ubuntu is used in this post.

Steps you need to follow.

1.SSH into the server where your HTTP website lives.

2.Install snapd package manager.

sudo snap install core; sudo snap refresh core

3.Install Certbot

sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot

4.Finally run this command if you want to configure your Nginx webserver with an SSL certificate automatically under the hood.

sudo certbot --nginx

5.Or if you want to get a certificate and wanna configure everything on your own run this command.

sudo certbot certonly --nginx

6.Reload nginx server

sudo service nginx restart
sudo service nginx status

7.Confirm your SSL Certificate just by typing your website domain with HTTPS protocol.

Now, most probably you won't see any error while visiting your website with https protocol.