First, we need to install Certbot on the server by running the following command
sudo apt install certbot python3-certbot-nginx
Note: Make sure that your site is properly configured in Nginx before installing SSL
Now, Install Let's Encrypt by running the following command
sudo certbot --nginx -d example.com -d www.example.com
After the Installation of Let's Encrypt SSL, test the auto renewal by running the following command
sudo systemctl status certbot.timer
And to test the renewal process, run the following command to do a dry run:
sudo certbot renew --dry-run