This guide will help you secure your Nginx server using a free SSL certificate from Let’s Encrypt via Certbot.
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d example.com -d www.example.com
Certbot will ask for your email address and for you to agree to the terms of service. Once complete, it will automatically configure your Nginx server with SSL.
After this, your site should be accessible via https://
and auto-renewals will be configured by default.