Take the 2-minute tour ×

Here is the error i am getting in nginx ssl:

nginx: [emerg] SSL_CTX_use_PrivateKey_file("/root/cert/l.key") failed (SSL:  error:140B0009:SSL routines:SSL_CTX_use_PrivateKey_file:PEM lib)

Searched everywhere but could not find its solution.


share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

You've stuck the key file into /root/cert. Does the nginx process have the privs to descend into that directory? I would be surprised if it did, as it typically will run as non-root.

share|improve this answer
yes, i have set the proper permissions. Even i tried with 777, but didnt worked. –  Farhan May 14 '12 at 12:51
What about the perms on /root? –  cjc May 14 '12 at 13:18
add comment
  1. Does the file exist?
  2. Does it contain a valid SSL key?
  3. Does the key require a password?

This could be a special nginx problem. Apache requires you to specify a separate SSLCertificateChainFile directive. nginx requires you to concatenate any the intermediate chain certificates into the .crt file. nginx can give this error if the first certificate in the .crt file is not the one that matches the key. You have to concatenate the chain certs onto the end of your cert, not the other way around.

share|improve this answer
File does exists and its permissions are fine. Yes, the same file is working fine with Apache, but not with nginx. no, the key does not requires password –  Farhan May 14 '12 at 12:05
Tried by concatenating the chain certificate, still didnt worked :( –  Farhan May 14 '12 at 12:55
add comment

Incorrect order?


If intermediate certificates should be specified in addition to a primary certificate, they should be specified in the same file in the following order: the primary certificate comes first, then the intermediate certificates.

share|improve this answer
Still didnt worked –  Farhan May 15 '12 at 7:02
add comment

Your Answer


