SSL Certificates and HTTPS: What the Padlock Means and How to Set It Up
In this article
An SSL certificate is a small file, issued by a certificate authority, that ties your domain name to a cryptographic key. When a browser connects to your site over HTTPS it checks that file and agrees a fresh session key with your server. From then on everything sent in either direction is encrypted. The padlock in the address bar (now a small "tune" icon in Chrome, though everyone still calls it the padlock) means that check passed and the connection is encrypted. It does not mean the site is honest, well run or safe to buy from. A phishing site can have a padlock too.
Setting one up on your own server takes about ten minutes with Let's Encrypt and Certbot, costs nothing, and renews itself. The real work is in the details: covering both the www and bare domain, redirecting every http address to https in a single hop, and serving the full certificate chain. It also means clearing mixed content and switching on HSTS so browsers never try the insecure version again.
What a certificate actually does
Three separate things happen when you load an HTTPS page, and the certificate is only involved in the first.
- Identity. The server sends its certificate. The browser checks that the name on it matches the address typed and that it has not expired. It also checks that it was signed by a certificate authority (CA) on the browser's built-in trusted list, such as Let's Encrypt, DigiCert or Sectigo.
- Key exchange. Browser and server agree a session key through the TLS handshake. TLS 1.3 does this in a single round trip.
- Encryption. Every request and response is then encrypted with that session key. Someone on the same cafe Wi-Fi can see which domain you connected to, but not the pages, form contents or cookies.
The name is a historical accident. SSL was the protocol of the 1990s, and every version of it has since been broken and disabled. What runs today is TLS (Transport Layer Security), versions 1.2 and 1.3; "SSL certificate" has simply stuck as the everyday term.
Why HTTPS stopped being optional
Three changes made HTTPS the default for every site, not just banks and shops.
- Google announced in 2014 that HTTPS is a ranking signal. It is a small one, but it is the one you can fix in an afternoon.
- Chrome and Safari label any http page "Not secure" in the address bar, and Firefox shows a crossed-out padlock. A brochure site that collects nothing still gets the warning.
- HTTP/2 and HTTP/3, the faster protocols every browser now uses, are only offered over HTTPS. The TLS handshake adds a little to the first response, but HTTP/2 wins that back on any page with twenty assets. Our post on how server response time affects rankings covers where that time goes.
There is also the legal point: UK GDPR requires appropriate security for personal data, and a contact form submitted over http crosses the internet in plain text.
The types of certificate and which to buy
Resellers still sell a ladder of products. The differences are in how thoroughly the CA checked who you are, not in the strength of the encryption, which is identical.
| Type | What the CA checks | Cost | Who needs it |
|---|---|---|---|
| Domain Validated (DV) | That you control the domain, via a file on the server or a DNS record | Free from Let's Encrypt and ZeroSSL | Almost every website, including online shops |
| Organisation Validated (OV) | DV plus a check that the company exists at Companies House or equivalent | Paid, renewed annually | Rarely; some procurement questionnaires ask for it |
| Extended Validation (EV) | OV plus a stricter manual vetting process | Paid, more expensive | Almost nobody since browsers removed the green company-name bar |
| Wildcard | DV or OV for every subdomain at once | Free from Let's Encrypt via a DNS challenge | Platforms that give each customer a subdomain |
Browsers show the same icon for all four. A DV certificate from Let's Encrypt on a shop taking card payments is normal and correct; the card details go to Stripe over Stripe's own connection in any case.
How Let's Encrypt renewal works
Let's Encrypt certificates last 90 days, on purpose. A short life limits the damage if a key leaks, and it forces renewal to be automated. Paid certificates are heading the same way. Under rules agreed by the CA/Browser Forum, no public certificate issued since March 2026 can last more than 200 days. The limit drops in steps to 47 days by 2029.
The cycle on a typical VPS looks like this.
- Certbot (or the ACME client built into Caddy, Traefik or your hosting platform) asks Let's Encrypt for a certificate covering your names, for example example.co.uk and www.example.co.uk.
- Let's Encrypt sets a challenge. The HTTP-01 challenge asks for a specific file at /.well-known/acme-challenge/ on port 80; the DNS-01 challenge asks for a TXT record. Passing it proves you control the domain.
- The certificate and its intermediate chain are written to disk, usually under /etc/letsencrypt/live/, and the web server is reloaded.
- A systemd timer runs the renew command twice a day. It does nothing until the certificate is within 30 days of expiry, then repeats the challenge and reloads Nginx. Day 60 of a 90-day certificate is the usual renewal day.
sudo certbot --nginx -d example.co.uk -d www.example.co.uk
sudo certbot renew --dry-run
systemctl list-timers | grep certbot
The dry run is the line people skip. It exercises the whole renewal path without issuing anything. It is how you discover that port 80 is firewalled or the challenge path is being redirected, before the certificate expires rather than after. Renewal failures are quiet: Certbot logs the error, and the site keeps working on the old certificate until the day it does not. Put a monitor on the expiry date. It is one of the alerts included in the maintenance we run on sites we built. An expired certificate is the most common way a healthy site goes dark on a Sunday.
Setting up HTTPS properly on a Django site
Getting a certificate is the easy half. These steps turn "it has a certificate" into "it is fully secure".
1. Cover every name
A certificate is valid only for the names listed inside it. Issue it for the bare domain and www, and for any subdomain that serves pages. A visitor who types the one you forgot gets a full-page warning.
2. Redirect http to https in one hop
Every http address should answer with a permanent 301 redirect to its https twin, with the www or non-www question settled in the same hop. Chained redirects waste a round trip each. If you are unsure whether a redirect or a canonical tag is the right tool for a duplicate address, canonical tags versus 301 redirects settles it.
3. Send the full chain
Your server must send your certificate and the intermediate certificate that links it to the CA's root. Chrome quietly fetches a missing intermediate on its own, so a broken chain looks fine on your laptop. The same chain fails on older Android phones and in payment systems that call your site. Certbot's fullchain.pem contains both; point Nginx at that file, not cert.pem.
4. Tell Django it is behind HTTPS
On a typical VPS setup Nginx terminates TLS and talks plain http to Gunicorn on the same machine, so Django has to be told to trust the proxy's header. The settings below redirect stray http requests, mark cookies secure so they never travel in the clear, and send the HSTS header.
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
SECURE_SSL_REDIRECT = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
SECURE_HSTS_SECONDS = 31536000
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_HSTS_PRELOAD = True
Running manage.py check --deploy lists any of these you have missed.
5. Clear mixed content
Mixed content is an https page that loads an image, script or stylesheet over http. Browsers block insecure scripts outright and try to upgrade images, blocking them if that fails. The usual culprits are hard-coded http addresses in old blog posts, a third-party widget, and absolute URLs stored in the database during a move from another platform. Search the database and templates for "http://" and fix each one; a Content-Security-Policy header of upgrade-insecure-requests catches stragglers.
6. Switch on HSTS, carefully
The Strict-Transport-Security header tells the browser to use https for this domain for the next max-age seconds without even trying http. That closes the gap where the very first request could be intercepted. Start with a short max-age such as 300 seconds, confirm every subdomain works over https, then raise it to a year. The preload flag submits you to a list baked into browsers and is close to irreversible, so add it last.
Checking it is right
- Run the Qualys SSL Labs server test. An A grade means the chain is complete, only TLS 1.2 and 1.3 are offered, and weak cipher suites are off. A B with "chain issues" is the missing intermediate from step 3.
- Open the site in a private window on a phone over mobile data, on the www and bare addresses and on an http address. Each should land on the https version with no warning and no second redirect.
- Note the certificate's expiry date and which automated job renews it.
Our free website health check runs the redirect and header checks on any address, and the website security checklist covers the other headers that belong alongside HSTS.
Questions people ask
Why has the padlock disappeared from Chrome?
Chrome replaced the padlock with a small "tune" icon in 2023, because Google felt the padlock suggested a site was trustworthy rather than merely encrypted. Clicking the icon still shows the certificate, and an http page is still marked insecure.
Does an SSL certificate make my website secure?
It secures the connection between the visitor and your server. It does nothing about an out-of-date dependency, a weak admin password or an injection bug in the code. HTTPS is the floor, not the ceiling.
What happens when a certificate expires?
Every browser shows a full-page warning that most visitors will not click through, and any webhook or payment callback calling your site fails. The fix takes minutes; the cost is the hours before someone notices.
How we handle this on our own builds
Every site we launch gets a Let's Encrypt certificate for every name it serves and a single-hop 301 from http to https. It also gets the Django settings above and a monitor on the expiry date. HTTPS goes on the staging site first, so mixed-content problems are found while the client is clicking through the preview rather than after launch. If you have an existing site, the fifteen-minute job this week is the SSL Labs test and a straight answer to what renews the certificate. If nobody knows, that is the finding.