How to Fix Cloudflare HTTP Error 526 : Invalid SSL Certificate?
Introduction
Error 526, or the “SSL Certificate is invalid,” is a problem that website owners and administrators repeatedly come across. This error is expected when the SSL certificate of a certain site is damaged and connections to the site cannot be secure.
That may cause disappointed users, less traffic, and even become the source of safety threats. Here in this guide, we will narrate the common causes of this error, and guide you on how to fix it efficiently and in the shortest time possible.
Also Read: How to Solve the Invalid SSL /TLS Certificate Error?
Regardless of whether you are managing a website or running a blog or are a website developer or IT expert, it is imperative to develop knowledge in fixing Error 526 for a site that one wants to keep safe and always accessible.
Now, it is time to look at the leading cause of home financing and how to tackle these issues.
Causes of Cloudflare 526 Error
- Expired SSL Certificate
- Mismatched Domain Name
- Incomplete Certificate Chain
- Self-Signed Certificate
- Incorrect Server Configuration
- Incorrect File Permissions
- Mismatched Private Key
- Unsupported SSL/TLS Version
- Certificate Revocation
- DNS Misconfiguration
- Clock Synchronization Issues
- Firewall or Security Software Interference
- SSL Certificate Not Trusted by Browser
Step-By-Step Process to Fix Error 526
Expired SSL Certificate
Issue:
One of the most frequent causes of Error 526 is an expired SSL certificate.
Solution:
- Check your certificate’s expiration date: openssl x509 -in your_certificate.pem -noout -dates
- If expired, renew your SSL certificate with your Certificate Authority (CA).
- Install the new certificate on your server:
For Apache:
SSLCertificateFile /path/to/your_new_certificate.pem
SSLCertificateKeyFile /path/to/your_private_key.pem
SSLCertificateChainFile /path/to/your_chain_file.pem
For Nginx:
ssl_certificate /path/to/your_new_certificate.pem;
ssl_certificate_key /path/to/your_private_key.pem;
- Restart your web server to apply the changes.
Mismatched Domain Name
Issue:
The domain name on the SSL certificate doesn’t match the website’s domain.
Solution:
- Verify the domain name on your certificate: openssl x509 -in your_certificate.pem -noout -subject
- If mismatched, do below process.
- Purchase a new SSL certificate for the correct domain.
- Generate a new CSR (Certificate Signing Request) with the correct domain.
- Install the new certificate on your server.
- For multi-domain certificates, ensure all domains are correctly listed in the SAN (Subject Alternative Name) field.
Incomplete Certificate Chain
Issue:
The intermediate certificates are missing or incorrectly installed.
Solution:
- Check your certificate chain: openssl s_client -connect your_domain.com:443 -showcerts
- If incomplete, proceed below.
- Obtain the full certificate chain from your CA.
- Combine your certificate with the intermediate certificates in the correct order.
- Update your server configuration to use the complete chain file.
- Restart your web server after making changes.
Explore More: Root Certificates vs Intermediate Certificates
Self-Signed Certificate
Issue:
Using a self-signed certificate instead of one from a trusted CA.
Solution:
- Identify if your certificate is self-signed: openssl x509 -in your_certificate.pem -noout -issuer -subject
- If self-signed: do below things.
- Purchase an SSL certificate from a trusted CA.
- Generate a new CSR and obtain the certificate.
- Install the new certificate on your server.
- Avoid using self-signed certificates in production environments.
Explore more: How to Resolve the “Self-Signed Certificate in Certificate Chain” Error?
Incorrect Server Configuration
Issue:
The server is not correctly configured to use the SSL certificate.
Solution:
- Check your server configuration files for SSL settings.
- Ensure the paths to your certificate files are correct:
For Apache (/etc/apache2/sites-available/default-ssl.conf):
SSLCertificateFile /path/to/your_certificate.pem
SSLCertificateKeyFile /path/to/your_private_key.pem
SSLCertificateChainFile /path/to/your_chain_file.pem
For Nginx (/etc/nginx/sites-available/default):
ssl_certificate /path/to/your_certificate.pem;
ssl_certificate_key /path/to/your_private_key.pem;
- Verify that SSL is enabled for your virtual host.
- Restart your web server after making changes.
Explore more: Top 10 SSL/TLS Misconfigurations, Risks & Solutions
Incorrect File Permissions
Issue:
Incorrect file permissions can prevent the web server from reading the certificate files.
Solution:
- Check current file permissions: ls -l /path/to/your/ssl/files
- Set correct permissions:
sudo chmod 644 your_certificate.pem
sudo chmod 600 your_private_key.pem
- Ensure the web server user (e.g., www-data for Apache) has read access to the certificate files.
- Restart your web server.
Mismatched Private Key
Issue:
The private key doesn’t match the SSL certificate.
Solution:
- Verify that the private key matches the certificate using command:
openssl x509 -noout -modulus -in your_certificate.pem | openssl md5
openssl rsa -noout -modulus -in your_private_key.pem | openssl md5
- If the outputs don’t match, do below steps.
- Generate a new CSR using the correct private key.
- Obtain a new certificate from your CA.
- Install the new certificate and ensure it matches the private key.
Explore more: How to Verify the Integrity of an SSL/TLS Certificate and Private Key Pair?
Unsupported SSL/TLS Version
Issue:
The server is configured to use outdated or unsupported SSL/TLS versions.
Solution:
- Check supported SSL/TLS versions: nmap –script ssl-enum-ciphers -p 443 your_domain.com
- Update your server configuration to use modern TLS versions:
- For Apache: SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
- For Nginx: ssl_protocols TLSv1.2 TLSv1.3;
- Restart your web server to apply the changes.
Explore more: How to Check the TLS Version of your Website?
Certificate Revocation
Issue:
The SSL certificate has been revoked by the issuing CA.
Solution:
- Check if your certificate is revoked:
openssl ocsp -issuer /path/to/issuer_cert.pem -cert /path/to/your_cert.pem -text -url http://ocsp.your-ca.com
- If revoked, do below things.
- Contact your CA or provider to understand the reason for revocation.
- Purchase a new SSL certificate.
- Generate a new CSR and obtain the new certificate.
- Install the new certificate on your server.
Explore more: How to Fix NET::ERR_CERT_REVOKED_Certificate Error?
DNS Misconfiguration
Issue:
Incorrect DNS settings can cause SSL certificate validation failures.
Solution:
- Verify your DNS settings: dig your_domain.com
- Ensure the domain points to the correct IP address.
- Check for any conflicting DNS records.
- If using CDN services, ensure proper SSL configuration on the CDN side.
Clock Synchronization Issues
Issue:
Server time that’s significantly out of sync can cause certificate validation failures.
Solution:
- Check your server’s current time: date
- If incorrect, update it: sudo ntpdate pool.ntp.org
- Configure NTP for ongoing synchronization:
sudo apt-get install ntp
sudo systemctl enable ntp
sudo systemctl start ntp
Firewall or Security Software Interference
Issue:
Overly restrictive firewall rules or security software can interfere with SSL connections.
Solution:
- Temporarily disable the firewall or security software to test.
- If the issue resolves, reconfigure your security settings:
- Allow inbound connections on port 443.
- Whitelist your web server process in the security software.
- Re-enable security measures with the new configuration.
SSL Certificate Not Trusted by Browser
Issue:
The certificate is from a CA not recognized by the user’s browser.
Solution:
- Verify your CA is widely trusted:
- Check major browser root certificate programs.
- Consider switching to a more recognized CA if necessary.
- If using an internal CA, do below steps:
- Install the root certificate on client machines.
- Consider using publicly trusted certificates for public-facing sites.
Conclusion
A proper solution to Error 526 Invalid SSL Certificate is paramount to ensuring a website’s optimal security and accessibility. Using skills derived from this guide, you will be in a position to identify causes and quickly address SSL certificate problems because you already know the solutions to the most common ones.
We supply various SSL products, protocols, and articles with precise instructions as well as dedicated customer support to ensure the security and efficiency of your website.