habibzain Just husband, father and enthusiastic men about System Administration. Love to write short article about it. Perhaps can help and be useful for others.

Install Let’s Encrypt Nginx On Ubuntu 20.04 / 18.04

1 min read

Secure Nginx with Let’s Encrypt On Ubuntu 20.04

Hi Dude. Today, Let’s Encrypt is a free certificate authority that allows you to set up such protection. In the previous article, it was explained how to install Nginx on Ubuntu. In this article i will describe easy method install lets encrypt nginx in ubuntu OS. This is simplest way to secure our Nginx server.

Prerequisites:

  • A system running Ubuntu 20.04 (or Ubuntu 18.04).
  • Access to a terminal window/command line.
  • Sudo or root privileges.
  • Nginx installed and set up.
  • A registered domain name.
  • A server block configured for that domain name (Nginx Virtual Host).

Install Certbot Lets Encrypt

The first step to securing Nginx with Let’s Encrypt is to install Certbot.

$ sudo apt update

The download and install Certbot and its Nginx plugin by running:

$ sudo apt install certbot python3-certbot-nginx

Check Nginx Configuration

We assume that nginx is installed and running well. If it has not been installed or configured correctly, you can see the nginx installation article at this link.

Adjust Firewall to Allow HTTPS Traffic

Ensure your firewall is active.

$ sudo ufw status

Nginx has three (3) profiles you can add as rules:

  • Nginx HTTP (opens port 80)
  • Nginx HTTPS (opens port 443 – encrypted traffic)
  • Nginx Full (opens port 80 and 443)

Obtain the SSL/TLS Certificate

Let go execute and run the command.

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

Next, we just follow the wizard during the installation process.

See also  Increase php Request Timeout

Enable Automatic Certificate Renewal

By default, Let’s Encrypt certificates expire every 90 days. Open the crontab configuration file with root user.

root@server# crontab -e

In this example, it does so at 05:00 a.m.

0 5 * * * /usr/bin/certbot renew --quiet

Finally, we should have successfully secured your Nginx with Let’s Encrypt that will generate SSL/TLS certificates for your domain.

That is how to install lets encrypt nginx in ubuntu OS. Hope it’s helpful, Feel free to leave a comment if you have any questions and I’ll appreciate it. thanks.

Source:
https://phoenixnap.com/kb/letsencrypt-nginx

Let's Buy Me Coffee.

Buy Me a Coffee at ko-fi.com

https://saweria.co/habibzain
https://ko-fi.com/habibzain
habibzain Just husband, father and enthusiastic men about System Administration. Love to write short article about it. Perhaps can help and be useful for others.

Easy Create Laravel Project with Composer

Requirement Laravel, a popular PHP framework, is renowned for its elegant syntax and robust features, making it a top choice for web developers. One...
habibzain
1 min read

Virtualbox Change Storage Size

Changing the storage size of a virtual machine in VirtualBox involves a few steps. Here’s a general guide. Backup your Virtual Machine (VM) Before...
habibzain
35 sec read

Easy Setup Logrotate Nginx Ubuntu

Log rotation is an important aspect of managing log files on a Linux system, including those generated by Nginx. Logrotate is a utility that...
habibzain
1 min read

Leave a Reply

Your email address will not be published. Required fields are marked *

Never miss good article from us, get weekly updates in your inbox