How to Setup Nginx with Let's Encrypt on Ubuntu 20.04


How to Setup Nginx with Let's Encrypt on Ubuntu 20.04

Prerequisites:

  • Ubuntu 20.04 Server Installed with Nginx and Hosted Website

Install Certbot on Ubuntu

Certbot is an open-source tool that simplifies and automates the process of obtaining and renewing certificates from Let’s Encrypt. We are going to install Certbot by using the Snap deployment system. Snap is pre-installed on Ubuntu 20.04.

Update snapd

Run the following commands to update snapd.

$ sudo snap install core
$ sudo snap refresh core

Install certbot snap

Note: If you have previously installed Certbot by using the standard apt command, then run the following command first to remove it. This will ensure that the Certbot snap works correctly.

$ sudo apt-get remove certbot

$ sudo snap install --classic certbot
certbot 1.11.0 from Certbot Project (certbot-eff✓) installed

Enable certbot command

$ sudo ln -s /snap/bin/certbot /usr/bin/certbot

Obtain your Certificate

When you run the command below, certbot will guide you through the process. Certbot also updates your NGINX configuration automatically to activate HTTPS.

$ sudo certbot --nginx

Obtain a Certificate for a specific domain or subdomain

$ sudo certbot --nginx -d www.example.com

Certificate Renewal Process

Certificates issued by Let’s Encrypt are valid for 90 days. During installation, certbot creates a scheduled task to automatically renew your certificates before they expire. As long as you do not change your web server configuration, you would not have to run certbot again.

Run the following command to test the automatic renewal process.

$ sudo certbot renew --dry-run

Utils

Newsletter


Related Posts

What is my Internet IP Address?

Discover your IP address over the internet

Validate Romanian CNP

How to validate the Romanian CNP with a JS function

Validating CIF for Romanian Company in JS

Validate CIF for Romanian companies in JS. Easily verify company information with our user-friendly tool. Ensure accuracy and reliability.

How to install Kali Linux in UTM Virtual Machine on M2 Macbook

How I installed a UTM virtual machine with Kali Linux on a Macbook PRO M2 chip

My cat ruin my SaaS LoyalXpert

After half year, LoyalXpert, the loyalty system builder for coffee shop oweners is shutdown

TikTok Ads Strategy from a SaaS founder

Here's a short tutorial from my disrupting strategy of doing Tiktok Ads as a SaaS Founder

Curated SEO Resources: Essential Tools and Tips

Discover a handpicked selection of indispensable SEO resources, including tools and tips, to optimize your website's performance.

A Week in the Life of an Invoice Wrangler: Navigating Ridesharing and Food Delivery Chaos

As an app founder in the ridesharing and food delivery industry, I found myself knee-deep in invoice reports from companies like Bolt, Uber, Glovo, and Bolt Food

Free HTML templates list for Startups

Free HTML templates list for startup. A complete list with free resources to build your next startup's website and gain the traction to the sky.

Deal with client requests in SaaS

How to deal with client requests in Saas which are seeing only their interests, not the product interest.