Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed

Searched everywhere but could not find its solution.


share|improve this question
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
  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

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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.