How to install Let's Encrypt for Nginx in Ubuntu

Let’s Encrypt provides SSL certificates at free of cost.

This article explains the steps to install Let's Encrypt for Apache in Ubuntu 20.

Step1: Login to the server as root.

Step2: Install Certbot.

#apt-get install certbot python3-certbot-nginx

Step3: Verify the domain virtualhost configuration.

Make sure the domain virtualhost is properly configured and ensure that the following values are existing.

server_name domain www.domain;

Here the domain should be the one we need to get the SSL certificate for.

Step4: Allow HTTPS traffic Through the Firewall.

#sudo ufw allow 'Apache Full'
#sudo ufw delete allow 'Apache'

Step5: Obtain SSL Certificate.

#certbot --nginx

This script will prompt you to answer a series of questions in order to configure your SSL certificate. Provide the appropriate data and press ENTER for each one.

Step6: Verify Certbot Auto-Renewal config.

#systemctl status certbot.timer

This service should be active and running.

Step7: Test the renew process using dry run.

#certbot renew --dry-run

If its not giving any errors, everything is working fine.

That's all…