Cover both the www and the bare domain in the certificate on Apache
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
- Put one name in ServerName and the other in ServerAlias, and make sure the certificate lists both.
- Test the configuration and reload Apache.
/ etc/ apache2/ sites-available/ site-ssl.conf
<VirtualHost *:443> ServerName example.com ServerAlias www.example.com SSLEngine on SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem </VirtualHost>
The examples use example.com. Replace it with your own domain.
Related
Scan your domain to see whether this applies to you.