webzod
account

Cover both the www and the bare domain in the certificate on nginx

tls.names.companion_not_covered · effort: minutes

Why it matters

The www and bare versions of the domain answer on HTTPS, but one of them is served with a certificate that is not issued for it. Visitors who type or follow that version see a security warning.

The fix

  1. Make sure both names are in server_name, or that each has a server block, and that the certificate lists both names.
  2. Test and reload nginx.
/etc/nginx/conf.d/site.conf
server {
    listen 443 ssl;
    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;
}

The examples use example.com. Replace it with your own domain.

Read the documentation (opens in a new tab)

Scan your domain to see whether this applies to you.