openssl – Nginx self-signed cert

Here’s my question, If I want to transport the self-signed certificate from another server to the Nginx server, do I have to choose the public certificate or the encrypted one with a key? I mean when I export the certificate there was 2 options
1- key pair < after I enter the key then it’s looks like this self-signed_cert.p12
2- public certificate < no key to enter and looks like this self-signed_cert.crt

Which one is the correct one to use? I tried both and I got this error

failed (SSL: error:0909006C:PEM routines:get_name:no start line:Expecting: TRUSTED CERTIFICATE) 

I edit the second one .crt to look like this

—–BEGIN TRUSTED CERTIFICATE—–
cert
—–END TRUSTED CERTIFICATE—–

The one that ends with .p12 looks so different to me so I didn’t change anything

And the second question, if the public certificate was exported without entering any key then how can I create the file .key?

Read more here: Source link