Shorts
Short1 min read

Nginx & Certbot Ubuntu

Quick guide to install and configure Nginx with SSL certificate using Certbot on Ubuntu

#nginx #ubuntu #ssl #devops

Prerequisites

  • Ubuntu 20.04 or later
  • Domain name pointing to your VM
  • Root or sudo access

Step 1: Install Nginx

bash
sudo apt update
sudo apt install nginx -y
sudo systemctl start nginx
sudo systemctl enable nginx

Step 2: Configure Firewall

bash
sudo ufw allow 'Nginx Full'
sudo ufw allow OpenSSH
sudo ufw enable

Step 3: Install Certbot

bash
sudo apt install certbot python3-certbot-nginx -y

Step 4: Get SSL Certificate

bash
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com

Step 5: Auto-renewal Test

bash
sudo certbot renew --dry-run

Verify

Visit https://yourdomain.com - you should see a secure connection! 🎉

Pro tip: Certbot automatically sets up a cron job for certificate renewal.

Share To Friends