Sure! Here’s a step-by-step guide on how to add Let’s Encrypt SSL using Certbot in Nginx:
- Install Certbot by running the following commands:
sudo apt-get update
sudo apt-get install certbot python3-certbot-nginx
Verify that your Nginx server block is configured properly. You can do this by running:
sudo nginx -t
If there are no errors, reload the Nginx configuration by running:
sudo systemctl reload nginx
Now, run the following command to obtain a certificate:
sudo certbot --nginx
- Follow the prompts to enter your email address and agree to the terms of service. Certbot will then detect your Nginx configuration and ask which domain(s) you want to secure. You can choose to secure multiple domains by separating them with commas.
Once you’ve selected the domains to secure, Certbot will automatically configure Nginx to use SSL and renew the certificate when necessary.
That’s it! Your Nginx server is now using SSL to encrypt traffic. You can verify this by visiting your website using HTTPS.