If You Are a Visitor
- Check the address: try the name with and without
www, and the main domain instead of a subdomain. - Try another network or browser: a network that intercepts HTTPS presents its own certificate, which never matches. If the site works elsewhere, that is the cause.
- Do not continue past the warning: a wrong name can also mean you reached the wrong server.
If You Own the Site: See Which Names the Certificate Covers
openssl s_client -connect example.com:443 -servername example.com </dev/null 2>/dev/null | openssl x509 -noout -subject -ext subjectAltName
The Subject Alternative Name list is what browsers check; they ignore the common name. Every name visitors type must appear there, either exactly or under a wildcard such as *.example.com. Repeat the test with -servername www.example.com and each other name. If the subject shows a different site or a hostname like the server's own, the wrong server block answered. More options are in openssl s_client.
The Usual Causes
- www missing: the certificate covers
example.combut visitors openwww.example.com, or the other way round. - Another site's certificate: the name has no HTTPS server block of its own, so the default block on port 443 answers with whatever certificate it holds.
- A self-signed or control panel certificate: a default HTTPS site, such as the one mod_ssl creates on AlmaLinux and Rocky Linux, answers with a certificate for the server's hostname.
- Visiting by IP address: certificates for domains do not cover the IP.
- A deeper subdomain:
*.example.comdoes not covera.b.example.comorexample.comitself. - DNS points elsewhere: the name reaches an old server or another service with its own certificate.
Fix a Missing www or Other Name
Reissue the certificate with every name. With Certbot and Nginx:
sudo certbot --nginx --cert-name example.com -d example.com -d www.example.com
With --cert-name, the list of -d names replaces the old list of that certificate. Check DNS for each new name first, because each one is validated. On Apache, use --apache. A redirect from www to the bare domain does not remove the need: the browser checks the certificate before it sees the redirect. Setup details are in Certbot with Nginx and Certbot with Apache.
Fix the Wrong Server Block
Nginx picks the HTTPS server block by the SNI name. When no server_name matches, the default server for port 443 answers, which is the one marked default_server or else the first one loaded. List which blocks exist:
sudo nginx -T 2>/dev/null | grep -nE "server_name|listen|ssl_certificate "
Give the affected name its own block with listen 443 ssl, the right server_name, and a certificate that covers it. In Apache, each name needs a *:443 virtual host whose ServerName or ServerAlias matches. Test with sudo nginx -t or sudo apachectl configtest, then reload.
Behind a CDN or Proxy
When a CDN proxies the domain, the browser sees the CDN's edge certificate. Make sure each name is set to be proxied and covered by the edge certificate. If a name bypasses the CDN, it reaches your server directly, which then needs a certificate for that name. Errors between the CDN and the origin are covered in Cloudflare error 525; an origin certificate that does not list the name fails Cloudflare's strict mode with Cloudflare error 526.
Confirm the Fix
- Run the openssl command again for every name and check that each appears in the alternative names.
- Test IPv6 separately with
-6if the domain has an AAAA record. - Open each name in a private browser window.
How names and certificates fit together is explained in what is SSL/TLS.