Setup Let’s Encrypt for Nginx using Certbot for Free SSL Certificate

Setup Let’s Encrypt for Nginx using Certbot for Free SSL Certificate

·

2 min read

Table of contents

No heading

No headings in the article.

Introduction: In today's digital landscape, securing websites with SSL (Secure Sockets Layer) certificates has become crucial. Let's Encrypt, a free and open certificate authority, offers a straightforward way to obtain SSL certificates. In this tutorial, we will explore how to set up Let's Encrypt for Nginx using Certbot, a popular tool for automating the certificate issuance and renewal process.

Table of Contents:

1: Check your nginx configuration is correctly set. The certbot program directly reads and writes into the nginx configuration file.

2: Add Certbot Repository

2: Installing Certbot

3: Obtain SSL Certificate

4: Generating SSL Certificate

5: Conclusion

Step 1: A server with Nginx installed and properly configured. A registered domain name pointing to your server's IP address.

Step 2: Add the certbot repository path and update

sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update

Step 3: Installing the certbot on Ubuntu

sudo apt-get install certbot python-certbot-nginx

Step 4: Generating the SSL certificate

sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com

You will be asked a few questions and in later steps you will be asked for redirection, select as per your requirement, I would recommend going for redirect.

Step 5: Conclusion

In this tutorial, we learned how to set up Let's Encrypt for Nginx using Certbot to obtain a free SSL certificate.

Let's Encrypt's certificate is issued for 90 days only. If we do not renew the certificate, it expires post 90 days. But thankfully, the certbot program can automatically renew the SSL certificate 30 days before expiration.

We are done…..

Now you are having NGINX server running with your domain name SSL certificates and ultimately your website running on HTTPS.