cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Go to solution

AWS EC2 Ubuntu SSL nginx 'ANY PRIVATE KEY' error

Sharing this for others as I spent the most part of a day bumping my head against it!

After downloading my generated-private-key and generate-csr files, then downloading the approved files *.crt, *.pem and gd*.crt on to my Windows PC, then uploading them on to my AWS EC2 instance, then setting up nginx as suited for my website I ran into the following problem where nginx -t was reporting an error "4605261420:error:09FFF06C:PEM routines:CRYPTO_internal:no start line:/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl/libressl-22.260.1/libressl-2.6/crypto/pem/pem_lib.c:683:Expecting: ANY PRIVATE KEY"

To further check I ran the following (with the same result/error message):
openssl rsa –noout –modulus –in generated-private-key


A bit of googling suggested check file type was a good idea which showed:


file generated-private-key

generated-private-key: UTF-8 Unicode (with BOM) text

Ok, that's the problem, file type should show as ASCII so further googling lead me here and with that, this solution:
// Assuming your placing your key file in /etc/ssl/private...
iconv -c -f UTF8 -t ASCII generated-private-key > /etc/ssl/private/<yourdomainname>.key
chmod 600 /etc/ssl/private/<yourdomainname>.key

 

Following the above nginx -t succeeded.

1 ACCEPTED SOLUTION
Employee

Hello @atlantisstorm ,

 

Welcome to the Community! 

Thank you so much for taking the time post your experience with the SSL install.  Your experience and how you solved it will be invaluable to other community members who are gurus like you.  Have a great weekend! 

Sales and Support available 24/7 via phone or chat

View solution in original post

1 REPLY 1
Employee

Hello @atlantisstorm ,

 

Welcome to the Community! 

Thank you so much for taking the time post your experience with the SSL install.  Your experience and how you solved it will be invaluable to other community members who are gurus like you.  Have a great weekend! 

Sales and Support available 24/7 via phone or chat

View solution in original post