DEV Community

Devops Den
Devops Den

Posted on • Edited on

Get Free SSL By Setting up Certbot with Nginx on AWS

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/

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay