Arama Yap Mesaj Submit
Request a Callback
+90
X
X

Select Your Currency

Turkish Lira $ US Dollar Euro
X
X

Select Your Currency

Turkish Lira $ US Dollar Euro

Contact Us

Location Halkali merkez neighborhood fatih st ozgur apt no 46 , Kucukcekmece , Istanbul , 34303 , TR
NGINX Technical Guide

NGINX SSL Certificate Not Working: Chain, Key, and Handshake Guide

NGINX SSL errors can be caused by missing certificate file, private key mismatch, incomplete intermediate chain, incorrect SNI vhost, expired certificate, or TLS incompatibility. This guide verifies certificate-key matching and actual offered chain.

SSL HandshakeFullchainPrivate KeySNICertbot
root@server:~SSH
nginx: [emerg] SSL_CTX_use_PrivateKey("/etc/ssl/private/example.key") failed
error:05800074:x509 certificate routines::key values mismatch
SSL_do_handshake() failed
Request flowClient, NGINX, and backend connection break point
ConfigurationValidation of active server and location blocks
Live diagnosisLog, socket, port, and service controls
Secure ApplicationTest, controlled reload and result verification
01
Technical description

What does an NGINX SSL and handshake error mean?

In the HTTPS connection, NGINX must load the correct certificate chain and matching private key, the client must select a vhost suitable for SNI, and agree on a common TLS protocol/cipher suite.

A fullchain file containing the server certificate and intermediate certificates in the correct order should be used for the ssl_certificate.

If the private key certificate does not match, the NGINX config test will fail with a key values mismatch error similar to 'test key values mismatch'. Instead of relying on file names, the public key fingerprint/modulus should be compared.

The same IP has multiple HTTPS domains separated by SNI. If server_name matching or default SSL server is incorrect, the user may see a certificate for a different domain.

Even if Certbot renewal is successful, NGINX might be looking at the old copy of the file or hasn't been reloaded. The serial number of the live certificate should be compared with the one on disk.

Do not share the certificate and key via email or open terminal output; instead, compare the public fingerprint and file permissions.

02
Log messages and their meanings

SSL, certificate chain, and handshake messages

Search for the phrase you see in the email, browser, or SSH log. Each card includes meaning, probable cause, and safe initial action.

8 registration
01kritik

key values mismatch

Meaning: The certificate and private key do not belong to the same key pair.

Possible cause: Incorrect key file or path confusion after refresh.

Compare public key hash values.
02kritik

SSL_CTX_use_PrivateKey_file failed

Meaning: NGINX failed to load the private key.

Possible cause: File not found, permission, format, encrypted key, or match error.

nginx -t ve dosya izin/format kontrolü yapın.
03kritik

cannot load certificate ... BIO_new_file failed

Meaning: The certificate file cannot be opened.

Possible cause: Incorrect path, broken symlink, or permissions.

Verify the file chain using realpath and namei.
04warning

SSL_do_handshake() failed

Meaning: TLS negotiation was not completed.

Possible cause: Protocol/password mismatch, client issue or bad traffic.

Test using OpenSSL s_client based on hostname and TLS version.
05warning

certificate has expired

Meaning: The provided certificate has expired.

Possible cause: Refresh or reload failed.

Check the live certificate date and Certbot timer/log.
06warning

unable to get local issuer certificate

Meaning: Client cannot complete the chain to a trusted root.

Possible cause: Incomplete or incorrect intermediate chain.

Verify the fullchain order in the ssl_certificate file.
07warning

wrong certificate is served

Meaning: Another vhost certificate is provided for the requested hostname.

Possible cause: SNI/server_name/default_server error.

Use openssl s_client -servername to check the provided subject/SAN value.
08bilgi

no "ssl_certificate" is defined for the "listen ... ssl" directive

Meaning: SSL listening server block has no certificate defined.

Possible cause: Missing include or incorrect server block structure.

Examine the active SSL server block using nginx -T.

No records matching this expression were found.

03
Secure first review

SSH diagnostic commands and what output to look for?

Commands are for root access. Collect only status and logs first; Do not change the permanent setting without seeing the reason.

NGINX SSL config test
nginx -t
nginx -T | grep -nE 'listen .*ssl|server_name|ssl_certificate(_key)?'

Displays active certificate paths and SSL vhosts.

Live certificate review
echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | openssl x509 -noout -subject -issuer -serial -dates -ext subjectAltName

Displays the actual certificate and SAN information.

Certificate-key match
openssl x509 -in /etc/letsencrypt/live/example.com/fullchain.pem -pubkey -noout | openssl sha256
openssl pkey -in /etc/letsencrypt/live/example.com/privkey.pem -pubout | openssl sha256

The public key hash match is verified without showing the private key.

Chain validation.
openssl verify -CAfile /etc/ssl/certs/ca-certificates.crt /etc/letsencrypt/live/example.com/cert.pem
openssl s_client -connect example.com:443 -servername example.com -showcerts </dev/null

Verifies the certificate chain and intermediate certificates.

Certbot yenileme
certbot certificates
systemctl status certbot.timer --no-pager
journalctl -u certbot -n 100 --no-pager

Displays the refresh date, timer, and error logs.

Test and reload
nginx -t && systemctl reload nginx
openssl s_client -connect example.com:443 -servername example.com </dev/null 2>/dev/null | openssl x509 -noout -serial -dates

Verifies that the new certificate is live.

04
By hosting environment

Ubuntu/Debian, AlmaLinux/CloudLinux and Plesk controls

Although the root cause of the NGINX error is the same, package paths, service names, security layers and virtual host management vary depending on the Linux distribution or Plesk infrastructure used.

Ubuntu / Debian

NGINX SSL and Handshake Error for systemd, package path, and journald controls.

  • First, verify the active NGINX configuration and service status.
  • Compare the domain error log with the systemd log in the same time range.
  • Run nginx -t before the change, then perform a graceful reload.
nginx -t certbot certificates echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | openssl x509 -noout -dates -subject

AlmaLinux / CloudLinux

NGINX SSL and Handshake Error for SELinux, PHP-FPM pool, and RHEL-based service controls.

  • Check the active status of NGINX and related backend services.
  • Review SELinux AVC records and security contexts.
  • Do not restart the service without passing the configuration test.
nginx -t certbot certificates 2>/dev/null echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | openssl x509 -noout -dates -subject

Plesk Obsidian

NGINX virtual host files generated by Plesk: nginx SSL and handshake error check.

  • Review the additional directives in the Domains > Apache & nginx Settings section.
  • Separate manually created and Plesk generated files.
  • If necessary, recreate the web configuration for the relevant domain only.
plesk bin certificate --list -domain example.com nginx -t plesk repair web example.com -n
05
Safe solution order

NGINX SSL and Handshake Error Solution Steps

Look at the live certificate presented, not the file on disk; verify the path, match, chain, SNI, and TLS layers in order.

1

Read the live certificate with the hostname

Record subject, SAN, issuer, and dates using SNI.

echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | openssl x509 -noout -subject -issuer -dates -serial
2

Find active NGINX certificate paths

Verify which certificate and key file the real server block uses.

nginx -T | grep -nE 'server_name example.com|ssl_certificate(_key)?'
3

Check file and permission existence

Symlink chain, owner and key access must be secure.

namei -l /etc/letsencrypt/live/example.com/fullchain.pem namei -l /etc/letsencrypt/live/example.com/privkey.pem
4

Verify the certificate and key match

Public key hashes must be the same.

openssl x509 -in CERT -pubkey -noout | openssl sha256 openssl pkey -in KEY -pubout | openssl sha256
5

Check chain and SNI configuration

Fullchain order and server_name/default SSL vhost must be correct.

openssl s_client -connect example.com:443 -servername example.com -showcerts </dev/null
6

Config test, reload and revalidate

The new serial/date live endpoint should be visible.

nginx -t && systemctl reload nginx
06
Distinction by symptom

Special scenarios and decision trees

Key values mismatch

Incorrect private key file selected; hash matching is performed.

openssl x509 -in CERT -pubkey -noout | openssl sha256; openssl pkey -in KEY -pubout | openssl sha256
Certificate has expired

Certbot timer, challenge, and reload steps are checked.

certbot certificates; systemctl list-timers | grep certbot
Eksik intermediate chain

cert.pem should be replaced with the fullchain file.

openssl s_client -connect example.com:443 -servername example.com -showcerts </dev/null
Incorrect domain certificate.

SNI, server_name and default_server are examined.

nginx -T | grep -nE 'listen .*443|server_name|ssl_certificate'
Cloudflare Origin Certificate

The Origin certificate is for the Cloudflare-origin connection, not for browser trust.

Read Origin and proxied hostname certificates separately using the openssl command.
Certificate is selected in Plesk but looks old.

Hosting Settings and mail/panel certificate assignments are checked separately.

plesk bin certificate --list -domain example.com

Absolutely don't

  • Do not share the private key contents in terminal output or support messages.
  • Do not randomly combine certificate and chain files.
  • Do not unnecessarily shut down secure protocols to resolve the TLS issue.
  • Don't assume NGINX will automatically serve the new file after Certbot renewal.
  • Do not give 644/777 wide permissions to the private key file.

Post-solution verification

  • nginx -t başarılıdır.
  • Live certificate contains the correct hostname SAN.
  • Certificate and private key public hash values match.
  • Chain is completed by the client to the trusted root.
  • Live serial and validity dates belong to the expected renewed certificate.
07
Official technical resources

Official documentation of NGINX and related components

08
Internal SEO content set

Related NGINX error solutions

09
Frequently asked questions

NGINX SSL and Handshake Error Curiosities about

What does NGINX key values mismatch mean?

This indicates that the certificate and ssl_certificate_key file do not belong to the same key pair.

Why should fullchain.pem be used?

Server presents necessary intermediate certificates with its certificate; assists the client in completing its trust chain.

Why does NGINX show a wrong certificate?

SNI server_name match, default SSL vhost or listen order is incorrect, another vhost certificate may be provided.

Certbot renewed but old certificate is visible, why?

NGINX may be using a different file path, not reloaded, or a CDN is serving an old certificate.

Does SSL_do_handshake failed always indicate a server error?

No. Bots, old clients, and incompatible TLS offers can also generate this log; frequency and client information should be examined.

How to securely verify certificate-key match?

You can compare the SHA-256 hash values of the two files without showing the private key.

Where in Plesk does SSL get assigned separately?

Domain hosting, panel hostname, and mail service certificates can be assigned separately; each endpoint must be validated live.

EKA SOFTWARE AND INFORMATION SYSTEMS

Let's fix the error on your server permanently

By analyzing cPanel, WHM, CloudLinux, LiteSpeed, MariaDB, Exim and security layers together, we fix the root cause of the failure instead of just removing the service.

Get Server Support WhatsApp
Top