How To Secure Nginx with Let's Encrypt (Certbot) on Ubuntu 20.04

Louis SanchezAugust 15th 2021, 6:47

To access your instance using HTTPS through NGINX, you need to follow these steps:

Step 1 : Install the Let's Encrypt client, certbot

sudo apt-get update
sudo apt install certbot python3-certbot-nginx

Step 2 : Request a certificate from Let's Encrypt

sudo certbot --nginx -d -d

Step 3 : Enter an email address

Step 4 : Press A and ENTER to agree to the Terms of Service

Step 5 : Press N and ENTER

Step 6 : Select your choice then ENTER. (Press 2 and ENTER to redirect all traffic to HTTPS)

Step 7 : You’re done!

Step 8 : You can now go to

Step 9 : Let's Encrypt's certificates are only valid for 90 days. Certbot will run twice a day and automatically renew any certificate that’s within thirty days of expiration. To test the renewal process, you can run:

sudo systemctl status certbot.timer
sudo certbot renew --dry-run