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.
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. https://saweria.co/habibzain https://ko-fi.com/habibzain