Most guides about how to implement HTTPS on a website stop at “buy an SSL certificate and install it”. That leaves you with the three problems that actually break sites in production: visitors still reaching the HTTP version, a padlock that refuses to show because of mixed content, and a certificate that quietly expires at 3 a.m. on a Sunday.
This walkthrough covers the full chain on a real server: issuing a free Let’s Encrypt certificate with Certbot on Nginx and Apache, forcing every HTTP request to HTTPS, hunting down mixed content warnings, and finishing with a cron-based renewal and an independent expiry check so you are never surprised.
Important context for 2026: Let’s Encrypt stopped sending certificate expiration reminder emails in 2025. Nobody is going to warn you anymore. Monitoring is now your job, which is exactly why the last section of this guide matters more than the first one.
What “implementing HTTPS” really involves
Four distinct jobs, in this order:
- Obtain a certificate for your domain (and its www variant).
- Install and configure it in your web server so port 443 serves TLS.
- Redirect and clean up: force HTTP to HTTPS, rewrite internal resources, remove mixed content.
- Automate renewal and monitor it, because Let’s Encrypt certificates live 90 days (or 6 days if you opt into short-lived profiles).
Skip step 4 and you simply postpone an outage.

Prerequisites checklist
- A domain name with an A record (and AAAA if you use IPv6) pointing to your server’s public IP. Let’s Encrypt validates through DNS resolution, so this must already propagate.
- Root or sudo access over SSH. Shared hosting without shell access? Use your control panel’s one-click Let’s Encrypt feature instead and jump straight to the redirect and mixed content sections.
- Ports 80 and 443 open in your firewall and security group. Port 80 is still needed for the HTTP-01 challenge.
- A running Nginx or Apache instance with a server block or virtual host already answering on your domain.
- A full backup of your site and configuration files.
Quick firewall opening with UFW:
sudo ufw allow 'Nginx Full'
# or, for Apache
sudo ufw allow 'Apache Full'
sudo ufw status
Step 1: Install Certbot
Certbot is the official ACME client maintained by the EFF. The recommended installation path is the snap package, because distro repositories often ship outdated versions that lack current ACME features.
sudo snap install core && sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
certbot --version
Installation by platform
| System | Command | Note |
|---|---|---|
| Ubuntu / Debian | sudo snap install --classic certbot |
Preferred method, always current |
| Rocky / AlmaLinux / RHEL | sudo dnf install epel-release && sudo dnf install certbot python3-certbot-nginx |
Swap the plugin for python3-certbot-apache if needed |
| Any Linux (fallback) | pip install certbot certbot-nginx in a virtualenv |
You handle upgrades yourself |
| Docker / containers | Use certbot/certbot image or a reverse proxy with built-in ACME |
Caddy and Traefik issue certificates automatically |

Step 2: Issue and install the certificate on Nginx
Make sure your server block declares the right server_name, otherwise Certbot cannot match the domain:
server {
listen 80;
server_name example.com www.example.com;
root /var/www/example.com/public;
index index.php index.html;
}
Test and reload, then run Certbot with the Nginx plugin:
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d example.com -d www.example.com
Certbot will ask for an email address (use a monitored one, it is used for account recovery and policy notices), ask you to accept the terms, validate ownership over port 80, write the certificate to /etc/letsencrypt/live/example.com/ and rewrite your server block with the listen 443 ssl directives.
Prefer to keep control of your config?
Use the certificate-only mode and wire it up manually:
sudo certbot certonly --nginx -d example.com -d www.example.com
Then add to your own server block:
server {
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
server_name example.com www.example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
root /var/www/example.com/public;
index index.php index.html;
}
Step 3: Issue and install the certificate on Apache
Enable the SSL module and the default SSL site first:
sudo a2enmod ssl headers rewrite
sudo systemctl restart apache2
sudo certbot --apache -d example.com -d www.example.com
Your virtual host should contain a matching ServerName and ServerAlias:
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/public
</VirtualHost>
After Certbot finishes, a new file example.com-le-ssl.conf appears in /etc/apache2/sites-available/ containing the TLS directives:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/public
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
On RHEL-based systems the paths are /etc/httpd/conf.d/ and the service is httpd.
Which Certbot mode should you pick?
| Mode | Command | Best for |
|---|---|---|
| Plugin (automatic) | certbot --nginx / --apache |
Standard single-server sites |
| Webroot | certbot certonly --webroot -w /var/www/html -d example.com |
No downtime, custom configs, load balancers |
| Standalone | certbot certonly --standalone -d example.com |
No web server running (mail servers, APIs) |
| DNS-01 | certbot certonly --dns-cloudflare -d "*.example.com" |
Wildcard certificates, servers not exposed on port 80 |

Step 4: Force every HTTP request to HTTPS
Serving both protocols creates duplicate content, leaks cookies and keeps the padlock inconsistent. Pick one canonical origin and redirect with a permanent 301.
Nginx redirect
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
return 301 https://example.com$request_uri;
}
Use return 301 rather than a rewrite rule: it is faster and avoids regex surprises. If you also want to canonicalise www to non-www, add a second 443 block for www.example.com that redirects to the apex domain.
Apache redirect
In the port 80 virtual host:
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
Redirect permanent / https://example.com/
</VirtualHost>
Or, if you can only edit .htaccess:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
Behind a proxy, Cloudflare or a load balancer, test %{HTTP:X-Forwarded-Proto} instead of %{HTTPS}, otherwise you create an infinite redirect loop.
WordPress specifics
- Go to Settings > General and set both WordPress Address and Site Address to the https:// version.
- Or hard-code it in
wp-config.php:define('WP_HOME', 'https://example.com'); define('WP_SITEURL', 'https://example.com'); define('FORCE_SSL_ADMIN', true); - Behind a reverse proxy, add this above the “stop editing” line:
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') { $_SERVER['HTTPS'] = 'on'; }
A plugin can do this too, but server-level redirects are faster and survive plugin deactivation.
Step 5: Kill the mixed content warnings
Mixed content happens when an HTTPS page pulls an asset over plain HTTP. Browsers block scripts, iframes and stylesheets outright (active mixed content) and flag images as insecure. Result: no padlock, broken layout, or both.
Find the offenders
- Open DevTools > Console and look for “Mixed Content: The page at … was loaded over HTTPS, but requested an insecure resource”.
- Check the Network tab and sort by scheme.
- Crawl the whole site with a tool that reports insecure resources, or grep your codebase:
grep -rn "http://" /var/www/example.com/public --include="*.php" --include="*.css" --include="*.js"
Fix them at the source
- Update hard-coded URLs in templates and CSS to https:// or to relative paths such as
/assets/logo.png. - Rewrite the database on WordPress with WP-CLI (dry run first, it handles serialized data correctly):
wp search-replace 'http://example.com' 'https://example.com' --all-tables --dry-run wp search-replace 'http://example.com' 'https://example.com' --all-tables wp cache flush - Replace third-party resources that have no HTTPS version. Old widgets, counters and font CDNs are the usual suspects. Self-host them if the provider is dead.
- Add a safety net header while you clean up, which upgrades remaining insecure subresource requests:
# Nginx add_header Content-Security-Policy "upgrade-insecure-requests" always; # Apache Header always set Content-Security-Policy "upgrade-insecure-requests"Treat it as a bandage, not a cure: it does not help users on very old browsers and hides the real problem.
- Purge every cache: page cache plugin, object cache, Varnish, CDN. Stale HTML is the number one reason mixed content “comes back”.

Step 6: Harden the configuration
Once HTTPS works, spend ten minutes on these:
- HSTS: tells browsers to never use HTTP again for your domain. Enable it only after you are sure every subdomain works over TLS.
# Nginx add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; # Apache Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"Start with a short max-age such as 300 while testing, then raise it.
- Disable obsolete protocols: keep TLS 1.2 and TLS 1.3 only. The Certbot-provided options files already do this.
- Enable HTTP/2 or HTTP/3 on the 443 listener for the performance win that comes with TLS.
- Update sitemaps, canonical tags, hreflang and internal links to the https:// version.
- Add the HTTPS property in Google Search Console and resubmit the sitemap so indexing follows the migration.
- Run an SSL audit with an external testing service and aim for an A rating.
Step 7: Auto-renewal so the certificate never expires silently
Let’s Encrypt certificates are valid for 90 days and Certbot renews them when fewer than 30 days remain. The snap and most packages install a systemd timer automatically. Verify it before assuming anything.
Check what is already scheduled
systemctl list-timers | grep certbot
systemctl status snap.certbot.renew.timer
# cron-based packages instead place a file here:
cat /etc/cron.d/certbot
Test the renewal without touching production
sudo certbot renew --dry-run
This hits the Let’s Encrypt staging environment. If it fails, your real renewal will fail too. Fix it now, not in 89 days.
The cron job (when you prefer cron or have no systemd)
sudo crontab -e
Add a twice-daily attempt at off-peak minutes, with a reload hook so the web server picks up the new certificate:
17 3,15 * * * /usr/bin/certbot renew --quiet --deploy-hook "systemctl reload nginx" >> /var/log/certbot-renew.log 2>&1
For Apache, swap the hook for systemctl reload apache2 (or httpd). Random minutes matter: Let’s Encrypt asks clients not to hammer the API at exactly minute zero.
Reload hooks, the right way
Instead of repeating the hook in cron, drop it once into /etc/letsencrypt/renewal-hooks/deploy/reload.sh:
#!/bin/bash
systemctl reload nginx
systemctl reload postfix 2>/dev/null || true
sudo chmod +x /etc/letsencrypt/renewal-hooks/deploy/reload.sh
Scripts in deploy/ run only when a certificate was actually renewed. Scripts in pre/ and post/ run on every attempt, which is where you stop and restart a standalone listener if you use that mode.
The piece almost everyone forgets: an independent expiry check
Certbot can fail silently: a DNS change, a closed port 80, a full disk, an expired snap. Since the Let’s Encrypt expiry reminder emails were discontinued, you need your own alarm. Create /usr/local/bin/check-cert.sh:
#!/bin/bash
DOMAIN="example.com"
ALERT_DAYS=21
MAILTO="ops@example.com"
EXP=$(echo | openssl s_client -servername "$DOMAIN" -connect "$DOMAIN":443 2>/dev/null \
| openssl x509 -noout -enddate | cut -d= -f2)
if [ -z "$EXP" ]; then
echo "Cannot read certificate for $DOMAIN" | mail -s "TLS CHECK FAILED: $DOMAIN" "$MAILTO"
exit 1
fi
DAYS_LEFT=$(( ( $(date -d "$EXP" +%s) - $(date +%s) ) / 86400 ))
if [ "$DAYS_LEFT" -lt "$ALERT_DAYS" ]; then
echo "$DOMAIN certificate expires in $DAYS_LEFT days ($EXP)" \
| mail -s "TLS EXPIRY WARNING: $DOMAIN ($DAYS_LEFT days)" "$MAILTO"
fi
sudo chmod +x /usr/local/bin/check-cert.sh
sudo crontab -e
30 7 * * * /usr/local/bin/check-cert.sh
This checks the certificate as served to the public, not the one sitting on disk. That distinction catches the classic failure where renewal succeeded but the web server was never reloaded. Replace the mail call with a curl POST to a Slack or Teams webhook if that suits your team better.
Renewal methods compared
| Method | Pros | Watch out for |
|---|---|---|
| systemd timer (default) | Installed automatically, built-in randomised delay, logs in journald | Can be masked or disabled without anyone noticing |
| cron | Explicit, easy to audit, works everywhere | Duplicate jobs if the timer is also active (harmless but noisy) |
| Reverse proxy with built-in ACME | Zero configuration, renewal handled in-process | Less control over file paths and hooks |
| Control panel (cPanel, Plesk) | One click, no shell needed | Breaks after domain or DNS changes, alerting is often off by default |

Troubleshooting the usual errors
| Symptom | Likely cause | Fix |
|---|---|---|
| Challenge failed, connection refused | Port 80 blocked or DNS not pointing to this server | Open port 80, verify with dig +short example.com |
| Too many certificates already issued | Rate limit hit after repeated tests | Wait for the window to reset and use --dry-run while testing |
| ERR_TOO_MANY_REDIRECTS | Proxy or CDN already terminating TLS while the origin redirects again | Set the CDN SSL mode to full/strict and test X-Forwarded-Proto |
| Padlock missing but no errors | Passive mixed content (images, fonts) | Check the console, rewrite the URLs, purge caches |
| Certificate valid on disk, expired in browser | Web server never reloaded after renewal | Add a deploy hook that reloads Nginx or Apache |
| NET::ERR_CERT_COMMON_NAME_INVALID | The requested hostname is not in the certificate | Reissue with every variant: -d example.com -d www.example.com |
Final verification checklist
- https://example.com and https://www.example.com both load with a padlock.
- http:// versions return a 301 to https (test with
curl -I http://example.com). - Zero mixed content warnings in the console on home, category, product and checkout pages.
sudo certbot certificateslists the expiry date and all expected domains.sudo certbot renew --dry-runsucceeds.- Your expiry monitoring script runs from cron and can actually send an alert (force it once with a high
ALERT_DAYSvalue to confirm). - Search Console has the HTTPS property with the sitemap submitted.
Follow those seven steps and implementing HTTPS on a website becomes a one-hour task that stays fixed instead of a recurring fire drill.
FAQ
Is a free Let’s Encrypt certificate as secure as a paid one?
Yes. The encryption strength is identical because it depends on the TLS protocol and key, not on the price. Paid certificates add organisation validation, warranties and support, which matter for banks and large e-commerce brands but change nothing technically for most sites.
Is HTTPS port 443 secure?
Port 443 is simply the default port for TLS traffic. Its security comes from the configuration: a valid certificate, TLS 1.2 or 1.3 only, modern cipher suites and no fallback to plain HTTP. An outdated TLS configuration on port 443 is not secure just because it uses that port.
Does an HTTPS page mean the site is 100% safe?
No. HTTPS guarantees that the connection is encrypted and that the server matches the certificate. It says nothing about malware, phishing, weak passwords or vulnerable plugins. Phishing sites use valid certificates too, so the padlock means “private connection”, not “trustworthy business”.
How often does a Let’s Encrypt certificate renew?
Standard certificates last 90 days and Certbot renews them around day 60. Short-lived profiles of about 6 days are also available for setups with fully reliable automation. In both cases renewal must be automated and monitored, since expiry reminder emails are no longer sent.
Will switching to HTTPS hurt my SEO rankings?
Not if the migration is clean. Use 301 redirects, update internal links and canonical tags, keep the sitemap current and add the HTTPS property in Search Console. HTTPS is a lightweight positive ranking signal, and a small temporary fluctuation during re-crawling is normal.
Can I get HTTPS without shell access?
Yes. Most hosting control panels include a one-click Let’s Encrypt integration, and CDNs can terminate TLS at the edge. Verify that auto-renewal is enabled and that the origin connection is also encrypted, otherwise traffic between the CDN and your server travels in the clear.
Do I need a dedicated IP address for HTTPS?
No. SNI lets a single IP serve many certificates for different hostnames, and every browser in use today supports it.
How do I get a wildcard certificate?
Wildcards require the DNS-01 challenge, so you need a Certbot DNS plugin with API credentials for your provider: sudo certbot certonly --dns-cloudflare -d "example.com" -d "*.example.com". Renewal then works without exposing port 80.
Need a hand migrating a production site to HTTPS without downtime? The team at adproductstogo.com can audit your current setup, handle the certificate deployment and leave you with monitoring that actually alerts the right person.

