Fix a certificate with the wrong address
Give it the right name.
The server shows a certificate that belongs to another address, so browsers warn your visitors. It usually means one name was left out, often the one with or without www.
Before you start
- Whoever runs your server or hosting can do this. Send them this page.
- Write down every address the certificate must cover. Our check lists the ones it covers now.
- A certificate for *.example.com covers shop.example.com. It does not cover example.com or a.shop.example.com.
The steps
First add the missing name to the site's server_name line. Then list the names you have with sudo certbot certificates, and ask again for all of them plus the missing one. Any name you leave out is dropped. On Debian and Ubuntu, this also needs: sudo apt install python3-certbot-nginx
sudo certbot --nginx --cert-name example.com -d example.com -d www.example.comThen check the settings and reload.
sudo nginx -t && sudo nginx -s reloadIf it shows an error, or the site stops, put the saved copy back and restart the server program at once.
First add the missing name to the site's ServerAlias line. Then list the names you have with sudo certbot certificates, and ask again for all of them plus the missing one. Any name you leave out is dropped. On Debian and Ubuntu, this also needs: sudo apt install python3-certbot-apache
sudo certbot --apache --cert-name example.com -d example.com -d www.example.comThen check the settings and reload.
sudo apachectl configtest && sudo apachectl gracefulIf it shows an error, or the site stops, put the saved copy back and restart the server program at once.
Put a certificate for the missing name in the folder named by crt, then reload. Without a match, HAProxy sends the first file in the folder.
Then check the settings and reload.
sudo haproxy -c -f /etc/haproxy/haproxy.cfg && sudo systemctl reload haproxyIf it shows an error, or the site stops, put the saved copy back and restart the server program at once.
Write every name as a site address in the settings file, separated by commas. Caddy gets the certificates by itself.
Then check the settings and reload.
sudo systemctl reload caddyIf it shows an error, or the site stops, put the saved copy back and restart the server program at once.
In IIS Manager, open the site's Bindings, https, and select the certificate for that name. With several sites on one server, also tick Require Server Name Indication.
The free certificate covers example.com and one level below it. An address with two levels, such as a.shop.example.com, needs an Advanced Certificate or a shorter name.
Request a certificate that lists every name, then add it to the HTTPS listener. CloudFront only accepts certificates created in the us-east-1 region.
Open SSL/TLS Status, include the missing name, and choose Run AutoSSL.
Open SSL/TLS Certificates and reissue the certificate with every name ticked, including www.
Check that it worked
openssl s_client -connect example.com:443 -servername example.com -verify_hostname example.com </dev/null 2>/dev/null | grep "Verify return"The answer should be 0 (ok). Repeat it with www. Run it on the server. The openssl that comes with a Mac cannot do this.
To undo it
Put the previous certificate back. Keep it until the new one is confirmed.
Common mistakes
- Adding only the missing name and losing the others.
- Testing only one address. Check the site with www and without it.