Cover both the www and the bare domain in the certificate on nginx
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
- Make sure both names are in server_name, or that each has a server block, and that the certificate lists both names.
- 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.
Related
Scan your domain to see whether this applies to you.