Install Let’s Encrypt with Nginx On Ubuntu 22.04 Example

10-Feb-2023

.

Admin

Install Let’s Encrypt with Nginx On Ubuntu 22.04 Example

Hi Guys,

This post is focused on Install & Secure Nginx with Let's Encrypt. This article goes in detailed on How to Secure Nginx with Let's Encrypt on Ubuntu 20.04?. it's simple example of Nginx on Ubuntu 22.04 Install Let’s Encrypt. you will learn Ubuntu 22.04 on Install Let’s Encrypt with Nginx.

You can use this post for ubuntu 14.04, ubuntu 16.04, ubuntu 18.4, ubuntu 20.04, ubuntu 21 and ubuntu 22.04 versions.

Follow these steps to encrypt and configure the SSL certificate:

Step 1 – Install Certbot

Step 2 – Check Nginx Configuration

Step 3 – Allowing HTTPS Through the Firewall

Step 4 – Get Free SSL/TLS Certificate

Step 5 – Enable Automatic Certificate Renewal

Step 1: Install Certbot


Run the following command on the command line to install certbot:

sudo apt update

sudo apt install certbot python3-certbot-nginx

Step 2: Check Nginx Configuration

Run the following command on the command line to check that it is set up correctly:

sudo nano /etc/nginx/sites-available/example.com

You want to include a domain name with and without www. So enter the following command:

server_name example.com www.example.com

Step 3: Allowing HTTPS Through the Firewall

Check the firewall status by executing the following command on command line:

sudo ufw status

Allow Nginx full profile and type the following command to delete unnecessary Nginx HTTP profile allowance:

sudo ufw allow 'Nginx Full'

sudo ufw delete allow 'Nginx HTTP'

Step 4: Get Free SSL/TLS Certificate

Now, execute the following command on command line to get free ssl/tls certificate:

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

Step 5: Enable Automatic Certificate Renewal

Use the following command on the command line to create automatic renewal:

sudo systemctl status snap.certbot.renew.service

To test the renewal process, Use the dry command with certbot:

sudo certbot renew --dry-run

#Ubuntu