The 'No Alternative Certificate Subject Name Matches Target Host Name' error occurs when the SSL certificate installed on your server does not match the domain name you are trying to access. This guide will help you understand the cause of this error and provide step-by-step instructions on how to fix it.
Table of Contents
Understanding the Error
An SSL certificate is issued for a specific domain or subdomain. When you access a website via HTTPS, the server presents its SSL certificate to your browser. Your browser then checks if the domain name in the URL matches the domain name listed in the certificate. If there is no match, the browser displays the 'No Alternative Certificate Subject Name Matches Target Host Name' error.
This error can occur for various reasons, such as:
- The SSL certificate is issued for a different domain or subdomain.
- The SSL certificate has expired.
- There is a misconfiguration in your server's SSL settings.
Follow these steps to fix the 'No Alternative Certificate Subject Name Matches Target Host Name' error:
1. Verify the SSL Certificate
First, you need to verify the SSL certificate installed on your server. You can use an online SSL checker tool like SSL Labs' SSL Server Test or DigiCert SSL Installation Diagnostics Tool.
Enter your domain name in the input field and run the test. The results will show if your SSL certificate is valid and if it matches your domain name.
2. Check the Server Configuration
If the SSL certificate is valid and matches your domain name, the next step is to check your server's SSL configuration. The configuration files may vary depending on your server type (Apache, Nginx, etc.). Refer to your server's documentation for instructions on how to review and update your SSL settings.
Ensure that your server is configured to serve your website using the correct SSL certificate and that the server is set to allow secure connections using HTTPS.
3. Update or Renew the SSL Certificate
If the SSL certificate is expired or does not match your domain name, you need to update or renew the certificate. You can obtain a new SSL certificate from a trusted Certificate Authority (CA) like Let's Encrypt, DigiCert, or GlobalSign.
After obtaining the new SSL certificate, install it on your server and update your server's SSL configuration to use the new certificate.
Does the SSL certificate cover both the www and non-www versions of my domain?
Most SSL certificates cover both the www and non-www versions of a domain. However, you should verify this with your Certificate Authority or by checking the certificate's Subject Alternative Names (SANs) field.
Can I use a self-signed SSL certificate to avoid this error?
Using a self-signed SSL certificate may cause browser warnings, and it is not recommended for production environments. Instead, obtain an SSL certificate from a trusted Certificate Authority.
What is a wildcard SSL certificate?
A wildcard SSL certificate covers all subdomains of a domain. For example, a wildcard SSL certificate for
*.example.com would cover
mail.example.com, and any other subdomain.
How do I install a new SSL certificate on my server?
The process of installing an SSL certificate varies depending on your server type. Refer to your server's documentation for specific instructions.
How often do I need to renew my SSL certificate?
SSL certificates have an expiration date, typically one or two years from the issuance date. You need to renew your SSL certificate before it expires to avoid errors and browser warnings.