#!/bin/bash

# Update package list
echo "Updating package list..."
sudo apt update -y

# Install Certbot and the Nginx plugin
echo "Installing Certbot and Nginx plugin..."
sudo apt install -y certbot python3-certbot-nginx

# Obtain SSL certificate for your domain
echo "Obtaining SSL certificate..."
sudo certbot --nginx -d ec2-13-201-225-130.ap-south-1.compute.amazonaws.com

# Certbot automatic renewal (this is done by default)
echo "Setting up automatic renewal for SSL certificate..."
sudo systemctl enable certbot.timer

# Final message
echo "SSL setup complete. Your site should now be accessible over HTTPS."