HAProxy SSL / TLS Origin: Network OSI layer 6 · Presentation Last updated 18 Nov 2026

HAProxy: unable to load SSL private key from PEM file / no certificate found (crt bundle format)

HAProxy needs the certificate chain and private key concatenated in one PEM, and it can't read yours.

Exact message you may see unable to load SSL private key from PEM filehaproxy Unable to load SSL certificate from PEM file'bind :443' : unable to load SSL private key from PEM fileno private key found in PEM file HAProxyProxy: unable to load SSL certificate from PEM file
Seen on: HAProxy SSL Linux

Meaning

Build the bundle in the right order: cat fullchain.pem privkey.pem > site.pem (leaf, intermediates, key) or provide crt and key separately. Check file permissions, that the key matches the certificate and that there is a trailing newline between parts.

Common causes

  • Key missing from the bundle
  • Wrong order or missing newline between PEM blocks
  • Key/certificate mismatch
  • HAProxy user can't read the file
  • Encrypted key without passphrase support

⚡ Quick fix

  1. cat fullchain.pem privkey.pem > /etc/haproxy/certs/site.pem
  2. chmod 600 and set owner
  3. haproxy -c -f /etc/haproxy/haproxy.cfg

Detailed fix by platform

Shell

  1. bash
    cat /etc/letsencrypt/live/example.com/fullchain.pem /etc/letsencrypt/live/example.com/privkey.pem > /etc/haproxy/certs/example.com.pem
    haproxy -c -f /etc/haproxy/haproxy.cfg

How to diagnose

  1. Bundle — Chain + key?
  2. Order — Right?
  3. Permissions — Readable?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Network. Errors that are often confused with or caused by this one (click to open):

bad decrypt — openssl: bad decrypt / Could not read private key — wrong passphrase or cipher (SSL / TLS)bad decryptbad end line — PEM routines: bad end line / no start line — Windows CRLF line endings or truncated PEM file (SSL / TLS)bad end linechain order — Certificate chain in the wrong order: PEM bundle must start with the leaf, then intermediates (SSL / TLS)chain orderDjango — Django send_mail: ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] (EMAIL_USE_SSL vs EMAIL_USE_TLS on the wrong port) (Email / SMTP)DjangoHAProxy backend — HAProxy: SSL handshake failure on the backend (verify required, no CA file, SNI missing) (SSL / TLS)HAProxy backendpermission — nginx: [emerg] cannot load certificate key: BIO_new_file() failed (Permission denied) / open() failed (13: Permission denied) (SSL / TLS)permissionPFX export — Cannot export or import the certificate with its private key (PFX/PKCS#12 has no private key) (SSL / TLS)PFX exportPROXY protocol — PROXY protocol error: broken header / unexpected data from the load balancer (HTTP)PROXY protocolHAProxy

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.