Setting up Certbot with Nginx on AWS involves several steps to ensure your website is securely served over HTTPS. Here's a detailed guide:
Prerequisites:
- An AWS account
- An EC2 instance running Amazon Linux 2, Ubuntu, or another Linux distribution
- A registered domain name
- Nginx installed on your EC2 instance
Step-by-Step Guide:
Connect to Your EC2 Instance
ssh -i "your-key-pair.pem" ec2-user@your-instance-public-dns
Update Your System
sudo yum update -y # For Amazon Linux
# or
sudo apt update && sudo apt upgrade -y # For Ubuntu
Install Nginx
If Nginx is not already installed, you can install it using:
sudo yum install nginx -y # For Amazon Linux
# or
sudo apt install nginx -y # For Ubuntu
Install Certbot
sudo yum install -y certbot python2-certbot-nginx # For Amazon Linux
# or
sudo apt install certbot python3-certbot-nginx -y # For Ubuntu
Obtain an SSL Certificate
sudo certbot --nginx
Automatic Certificate Renewal
sudo certbot renew --dry-run
Verify HTTPS
After completing the setup, verify that your website is accessible over HTTPS by visiting https://your-domain-name.
Thank You
Read More about Devops on https://devopsden.io/
Top comments (0)