RackUp IT - View Cloud Hosting Plans

Get started now or speak directly with our engineering team for specialized assistance.

Logo
DevelopmentWEB & APPCalculatorTOOLServicesProductBlogOur TeamCareers
View Plans
Home>Blog>Nginx + Let's Encrypt: Free SSL With Certbot and an HTTP to HTTPS Redirect
VPS Hosting

Nginx + Let's Encrypt: Free SSL With Certbot and an HTTP to HTTPS Redirect

Alex Vance
Alex Vance
Published Oct 16, 2026•✓ Verified Expert Reviewed•3 min read
Nginx Let's Encrypt SSL guide cover

Key Takeaways

  • ✓Certbot's Nginx plugin gets the certificate and edits your config in one command.
  • ✓Port 80 must be reachable and DNS must point to the server first.
  • ✓Certificates last 90 days; Certbot's timer renews them automatically.
  • ✓A 301 redirect sends all HTTP traffic to HTTPS.

Table of Contents

  • •Nginx + Let's Encrypt: Free SSL With Certbot and an HTTP to HTTPS Redirect
  • •Before You Start
  • •Step 1: Install Certbot
  • •Step 2: Get the Certificate
  • •Step 3: Redirect HTTP to HTTPS
  • •Step 4: Confirm Auto-Renewal
  • •Optional: Redirect www to non-www (or the reverse)
  • •Wildcard Certificates
  • •Common Certbot Errors
  • •Frequently Asked Questions
  • •Rather Not Manage Certificates Yourself?

Nginx + Let's Encrypt: Free SSL With Certbot and an HTTP to HTTPS Redirect

Let's Encrypt gives you trusted SSL certificates for free, and Certbot automates the whole process for Nginx: it proves you own the domain, installs the certificate, updates your server block and renews it before it expires. This guide assumes Ubuntu or Debian with Nginx already serving your site on port 80.

Before You Start

  • Your domain's A record points to this server (check with dig +short example.com).
  • Port 80 and 443 are open in the server firewall and any cloud firewall. Let's Encrypt connects on port 80 to verify the domain. On Oracle Cloud, see opening ports 80 and 443.
  • An Nginx server block already uses server_name example.com www.example.com;.

Step 1: Install Certbot

sudo apt update
sudo apt install certbot python3-certbot-nginx

Certbot's own recommended method is the snap package (sudo snap install --classic certbot), which stays more up to date; either works.

Step 2: Get the Certificate

sudo certbot --nginx -d example.com -d www.example.com

Certbot asks for an email (for expiry warnings), verifies the domain, installs the certificate and adds the ssl_certificate lines to your server block. Certificates are stored in /etc/letsencrypt/live/example.com/.

Step 3: Redirect HTTP to HTTPS

Certbot can add the redirect for you. If it did not, add a separate server block for port 80:

server {
    listen 80;
    listen [::]:80;
    server_name example.com www.example.com;
    return 301 https://$host$request_uri;
}

Keep the /.well-known/acme-challenge/ path reachable if you use a more complex setup; Certbot's Nginx plugin handles this automatically during renewal.

Then test and reload:

sudo nginx -t && sudo systemctl reload nginx

Step 4: Confirm Auto-Renewal

Let's Encrypt certificates are valid for 90 days. Certbot installs a systemd timer (or snap timer) that renews them automatically. Check it with a dry run:

sudo certbot renew --dry-run
systemctl list-timers | grep certbot

Optional: Redirect www to non-www (or the reverse)

server {
    listen 443 ssl;
    server_name www.example.com;
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    return 301 https://example.com$request_uri;
}

Pick one canonical version and redirect the other so search engines see a single site.

Wildcard Certificates

A wildcard certificate (*.example.com) cannot use the normal HTTP check; it needs a DNS challenge. Use a Certbot DNS plugin for your DNS provider, or --manual --preferred-challenges dns (manual certificates do not renew automatically).

Common Certbot Errors

  • Timeout during connect (likely firewall problem): port 80 is blocked by the server or cloud firewall.
  • DNS problem: NXDOMAIN or the wrong IP: the domain does not point to this server yet; wait for DNS to update.
  • Could not automatically find a matching server block: add the domain to a server_name line, reload Nginx, and run Certbot again.
  • Too many certificates already issued: you hit Let's Encrypt's rate limits from repeated attempts; use --dry-run or the staging server while testing.

Other Nginx problems are covered in common Nginx errors and fixes, including 403 Forbidden.

Frequently Asked Questions

Is Let's Encrypt really free?
Yes. Certificates are free and trusted by all major browsers. They last 90 days and renew automatically with Certbot.

How do I redirect HTTP to HTTPS in Nginx?
Add a server block on port 80 with return 301 https://$host$request_uri;, then run nginx -t and reload.

How do I renew a Let's Encrypt certificate manually?
Run sudo certbot renew. Normally you never need to, because the Certbot timer does it twice a day when renewal is due.

Do I need to restart Nginx after renewal?
Certbot's Nginx plugin reloads Nginx after a successful renewal, so the new certificate is used automatically.

Rather Not Manage Certificates Yourself?

RackUp IT managed hosting issues and renews SSL certificates automatically and keeps the web server configured and patched, so HTTPS never quietly expires on you.

← Previous ArticleWordPress Migration Checklist: Before, During and After the MoveNext Article →Caddy vs Nginx vs Traefik: Which Web Server Should You Use?
Interactive 60-Second Tool

Unsure Which Cloud Hosting Plan Fits Your Site?

Answer 4 quick diagnostic questions to estimate the server CPU, RAM and storage you need with transparent pricing.

Free Migration 99.9% Uptime Target
Calculate My Hosting Build
Alex Vance
Written ByAlex Vance

Cloud Infrastructure Engineer.

99.9% Uptime Target

RackUp IT - View Cloud Hosting Plans

View Hosting Plans

View Hosting Plans

CONTENTS

  • Nginx + Let's Encrypt: Free SSL With Certbot and an HTTP to HTTPS Redirect
  • Before You Start
  • Step 1: Install Certbot
  • Step 2: Get the Certificate
  • Step 3: Redirect HTTP to HTTPS
  • Step 4: Confirm Auto-Renewal
  • Optional: Redirect www to non-www (or the reverse)
  • Wildcard Certificates
  • Common Certbot Errors
  • Frequently Asked Questions
  • Rather Not Manage Certificates Yourself?

Categories

  • VPS Hosting
  • DevOps & Tutorials
  • WordPress Hosting
  • Cloud Hosting
  • Server Stack
  • Networking & Security
  • Web Hosting / Managed Cloud
  • E-Commerce
  • Hosting & SEO
  • Hosting Benchmarks
  • Cloud Backup & DevOps
  • Managed VPS

Recent Posts

  • Vultr Alternatives in 2026: VPS Hosting for Developers Compared
  • Docker Port Mapping Explained: -p, EXPOSE and Compose ports
  • Bluehost Alternatives (2026): WordPress Hosting Without the Renewal Price Jump

Tags

NginxSSLLet's EncryptCertbotHTTPS

Related Posts

Vultr alternatives coverVPS Hosting
Nov 27, 2026

Vultr Alternatives in 2026: VPS Hosting for Developers Compared

Vultr's Regular Performance prices compared with DigitalOcean, Linode, Hetzner and a fixed-plan VPS at the 8 GB size, plus when container hosting fits better.

Read Article →
What is a VPS? Virtual private servers explainedVPS Hosting
Nov 20, 2026

What Is a VPS? Virtual Private Servers Explained

A VPS (virtual private server) is a virtual machine with its own operating system, resources and root access. How it works, uses, and when you need one.

Read Article →
Linode alternatives coverVPS Hosting
Nov 19, 2026

Linode (Akamai) Alternatives in 2026: VPS Hosting Compared

Linode's shared CPU prices from Akamai's own API, compared with DigitalOcean, Vultr and a fixed-plan VPS, plus when container hosting makes more sense.

Read Article →
Logo

Expert Web & App Development, UI/UX Design, Branding, and Consulting to scale your business.

Company

  • About Us
  • Blog
  • Contact
  • Our Team
  • Careers

Services

  • Web Development
  • App Development
  • UI/UX Design
  • Consulting
  • Managed WordPress VPS
  • Website Speed Test

Subscribe to our newsletter

We accept
  • bKash
  • Nagad
  • Rocket
  • Upay
  • CellFin
  • Meghna Pay
  • OK Wallet
  • Tap
  • mCash
  • DBBL Nexus
  • Visa
  • Mastercard
  • American Express
  • Crypto
Pay with Visa, Mastercard, American Express, DBBL Nexus, CellFin, Rocket, bKash, Tap, Meghna Pay, Nagad, mCash, Upay and OK Wallet. Verified by EPS

© 2026 Rackup IT Solution. All rights reserved.

Privacy PolicyTerms of Service