Installing Certbot:
sudo apt install certbot python3-certbot-nginx
Confirming Nginx’s Configuration:
sudo nano /etc/nginx/sites-available/example.com
sudo nginx -t
sudo systemctl reload
Allowing HTTPS Through the Firewall:
sudo ufw status
sudo ufw allow 'Nginx Full'
sudo ufw delete allow 'Nginx HTTP'
sudo ufw status
Obtaining an SSL Certificate:
sudo certbot --nginx -d example.com -d www.example.com
Verifying Certbot Auto-Renewal:
sudo systemctl status certbot.timer
sudo certbot renew --dry-run