Fixing SSL Certificate Issues (Let’s Encrypt, HTTPS Setup)


Common SSL Errors

  • Certificate expired.
  • Mixed content warnings (HTTP resources on HTTPS pages).
  • Domain mismatch (certificate doesn’t cover subdomains).

How to Fix:

1. Renew Let’s Encrypt Certificate


sudo certbot renew --dry-run  # Test renewal
sudo certbot renew            # Actual renewal
    

2. Fix Mixed Content Warnings

Update all URLs to HTTPS in your code:


<!-- Before -->
<img src="http://example.com/image.jpg">

<!-- After -->
<img src="https://example.com/image.jpg">

3. Redirect HTTP to HTTPS

Add to .htaccess (Apache):


RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    

4. Verify Domain Coverage

Use a wildcard certificate for subdomains:


sudo certbot certonly --manual --preferred-challenges=dns -d *.example.com
    

Prevention Tips

  • Set up auto-renewal for Let’s Encrypt certificates.
  • Use SSL Labs Tester to audit your setup.
  • Enforce HTTPS in your CMS (e.g., WordPress settings).
Note: Always back up existing certificates before renewing.

Did you find this article useful?