In this small tutorial, we add a free SSL certificate from Let’s Encrypt for Nginx on Ubuntu 20.04.

Install certbot Link to heading

1sudo apt install certbot python3-certbot-nginx

Update nginx server_name Link to heading

1sudo vim /etc/nginx/sites-available/default
2# search server_name and update it with your full domain name,
3# example: dev1.example.com dev2.example.com

Check nginx configuration and reload it Link to heading

1sudo nginx -t && sudo systemctl reload nginx

Obtaining an SSL certificate first time Link to heading

1sudo certbot --nginx -d dev1.example.com -d dev2.example.com

Verifying Certbot Auto-Renewal settings Link to heading

1sudo systemctl status certbot.timer

To make a manual test:

1sudo certbot renew --dry-run