DEV Community

Cover image for Assign a free SSL certificate to an nginx server with certbot
AMANI Eric
AMANI Eric

Posted on • Updated on

Assign a free SSL certificate to an nginx server with certbot

In this article, I will show you how you can add a free SSL certificate to your Nginx server with Certbot.

Before we start, check my previous article to understand more about SSL, and check here about serving a static app with Nginx.

What is certbot?

Certbot is an open-source automated software that generates Let's Encrypt Certificates. SSL
certificates are provided free of cost by the Internet Security Research Group(ISRG).

Let's get started 💎

Considering we already have our app being served by Nginx on our server, we can proceed to install certbot first.

Before you get started, I assume that.

  • You are familiar with Nginx
  • You have Nginx running on an ubuntu Linux server

Install certbot

$ apt-get update 
$ sudo apt-get install certbot 
$ apt-get install python-certbot-nginx
Enter fullscreen mode Exit fullscreen mode

Get SSL/TLS certificate

$ sudo certbot --nginx -d example.com
Enter fullscreen mode Exit fullscreen mode

Here example.com ☝🏾 is referring to the domain Nginx is using to serve our app.

If successful, you should get a response like below 👇🏽

Image description

Open the browser and visit your app. 
It should be using HTTPS with a valid SSL/TLS certificate ⚡️

Also check 👉🏽 Serve a static app with Nginx

Top comments (0)