Search code examples
sslnginxopensslcertificatekey

SSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch


I'm not able to setup SSL. I've Googled and I found a few solutions but none of them worked for me. I need some help please...

Here's the error I get when I attempt to restart nginx:

root@s17925268:~# service nginx restart
Restarting nginx: nginx: [emerg] SSL_CTX_use_PrivateKey_file("/etc/nginx/conf.d/ssl/ssl.key") failed (SSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch)
nginx: configuration file /etc/nginx/nginx.conf test failed

My certificate is from StartSSL and is valid for 1 year.

Here's what I tested:

  • The certificate and private key has no trailing spaces.
  • I'm not using the default server.key file.
  • I checked the nginx.conf and the directives are pointing to the correct private key and certificate.

I also checked the modulus, and I get a different modulus for both key and certificate.

Thank you for your help. :)


Solution

  • I got a MD5 hash with different results for both key and certificate.

    This says it all. You have a mismatch between your key and certificate.

    The modulus should match. Make sure you have correct key.