ssl-guides 2026-12-02 ⏱ 4 min read

How to Install Free SSL on Nginx

How to Install Free SSL on Nginx

Nginx is the most common web server for self-hosted sites, and certbot's nginx plugin makes free SSL nearly automatic. One command gets you a trusted Let's Encrypt certificate, an updated server block and a renewal timer. This guide covers the automatic path, the manual path and a few hardening steps worth doing afterward.

Prerequisites

  • Your domain's DNS points at the server's public IP address.
  • Nginx is serving the domain in a server block on port 80.
  • Ports 80 and 443 are open in the firewall. With ufw that is sudo ufw allow 'Nginx Full'.

Free SSL on Nginx, step 1: install certbot with the nginx plugin

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

Free SSL on Nginx, step 2: issue and install the certificate

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

Certbot validates the domain over HTTP, obtains the certificate, edits your server block to listen on 443 and adds the certificate paths for you. Choose the redirect option when prompted so HTTP traffic moves to HTTPS permanently. Confirm nginx is happy with the new config and reload it:

sudo nginx -t
sudo systemctl reload nginx

Step 3: Confirm auto-renewal

sudo certbot renew --dry-run

Certbot's systemd timer runs renewal checks twice a day and renews any certificate that is due. Since Certbot 4.0.0, that means less than a third of the lifetime is left, which is 30 days on a 90-day certificate (Certbot docs). Let's Encrypt's default lifetime drops to 64 days on 10 February 2027, and the one-third rule adjusts on its own. A clean dry run means you can stop thinking about expiry. The timer itself can be checked with systemctl list-timers if you ever want proof it is scheduled.

Manual free SSL setup on Nginx

If you got the certificate from another provider, configure the server block yourself:

server {
  listen 443 ssl;
  server_name example.com www.example.com;
  ssl_certificate /path/to/fullchain.pem;
  ssl_certificate_key /path/to/privkey.pem;
  root /var/www/example;
}

Note that nginx wants the full chain file: your certificate concatenated with the intermediate chain. Certbot provides this as fullchain.pem. Using only the bare certificate file is the classic cause of incomplete-chain warnings on Android and older browsers, even when desktop browsers seem fine.

Hardening steps worth doing

Verify

Load the site over HTTPS, confirm the padlock, then run an external SSL check to validate the chain and expiry date. If nginx runs in Docker, the certbot flow differs because certbot runs on the host while nginx runs in a container; installing free SSL with Docker, nginx and certbot covers the containerized setup with the webroot pattern.

Multiple sites on one server

Repeat the certbot command for each server block, or list several domains in one command if they share a certificate. Nginx selects the certificate by server_name, so each site gets its own HTTPS config cleanly. For large numbers of domains, a wildcard certificate via the DNS-01 challenge reduces the certificate count to one.

Redirecting at the server level

Certbot's redirect option adds a small port-80 server block that returns a 301 to HTTPS. Keep it: application-level redirects alone leave API clients and crawlers free to use plain HTTP. Server-level 301s are also trivially cheap for nginx to serve.

Renewal hooks for nginx

Certbot reloads nginx automatically after renewal when it installed the certificate through the nginx plugin, so no extra hook is needed in the standard setup. If you placed certificate paths into nginx configs manually, add a deploy hook that runs nginx -s reload so renewed files get picked up. Either way, test once with a dry run and watch the reload happen; that one test is the difference between automation you trust and automation you hope works.

Related reading: installing free SSL on Ubuntu, installing free SSL on Apache and choosing an SSL certificate for a VPS.

Frequently Asked Questions

Does Certbot reload Nginx after renewal?

Yes, when it installed the certificate through the nginx plugin. If you pointed Nginx at the certificate files by hand, add a deploy hook that reloads Nginx.

Why does my certificate warn on Android but not on a desktop browser?

The server is probably sending only the bare certificate. Point ssl_certificate at fullchain.pem so the intermediate chain is included.

How do I check that renewal will work?

Run sudo certbot renew --dry-run. Since Certbot 4.0.0, a certificate is renewed when less than a third of its lifetime is left (Certbot docs).

🔒 Test Your Website SSL Certificate Now
Run Free SSL Check →

✅ Post-Installation Verification & SEO Checklist

After applying the steps above, run through this 5-point checklist to prevent browser warnings and protect your Google SEO rankings:

  • Verify full CA chain trust and TLS 1.3 support using our Live SSL Checker.
  • Scan for Mixed Content HTTP links and check HSTS/CSP headers on Security Headers Checker.
  • Enforce a permanent 301 HTTP-to-HTTPS redirect with our HTTPS Redirect Generator.
  • Confirm both root and www versions resolve cleanly to one canonical HTTPS URL.
  • Verify your HTTPS property and sitemap.xml inside Google Search Console and Bing Webmaster Tools.
Technically Reviewed by TryFreeSSL Security Team
Last updated: 2026-12-05
About Us →

Free SSL Certificates, Live SSL Checker & CSR Generator

Issue trusted Let's Encrypt SSL certificates in 60 seconds with zero server setup.

Related Articles

🤖 TryFreeSSL AI Assistant