Get Free SSL By Setting up Certbot with Nginx on AWS

Devops Den - Jun 13 - - Dev Community

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:

  1. An AWS account
  2. An EC2 instance running Amazon Linux 2, Ubuntu, or another Linux distribution
  3. A registered domain name
  4. 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
Enter fullscreen mode Exit fullscreen mode

Update Your System

sudo yum update -y  # For Amazon Linux
# or
sudo apt update && sudo apt upgrade -y  # For Ubuntu

Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Install Certbot

sudo yum install -y certbot python2-certbot-nginx  # For Amazon Linux
# or
sudo apt install certbot python3-certbot-nginx -y  # For Ubuntu
Enter fullscreen mode Exit fullscreen mode

Obtain an SSL Certificate

sudo certbot --nginx
Enter fullscreen mode Exit fullscreen mode

Automatic Certificate Renewal

sudo certbot renew --dry-run
Enter fullscreen mode Exit fullscreen mode

Verify HTTPS

After completing the setup, verify that your website is accessible over HTTPS by visiting https://your-domain-name.
Enter fullscreen mode Exit fullscreen mode

Thank You
Read More about Devops on https://devopsden.io/

. . . . . . . . . . . . . . . . . . . . . . . . . . .