I use Ubuntu 16.04 with Nginx for my web server. I setup my website SSL with Let's Encrypt. And I want to get private, public key pair of Let's Encrypt.

Can someone point out where those files exist?

  • @techraf I already setup the ssl certificate. But, what I want to know is where is my public, private key pair. Aug 2, 2016 at 8:02
  • I use ubuntu 16.04 with nginx setup. And I use ssl for let's encrypt. I want to get public vs private key pair from my ssl. How do I get it? @techraf Aug 2, 2016 at 8:07
  • How you did it also affects where things may be located. I use the certonly option (don't want 3rd party messing w/ my webserver config, although I use apache not nginx) and so my stuff ends up under /etc/letsencrypt/example.com/live which are just symlinks to the actual certificates (archive versions, LE keeps several old versions for you automatically)
    – ivanivan
    Dec 12, 2017 at 3:34

1 Answer 1


For Nginx you need to check the /etc/nginx/sites-enabled directory for the configuration file of your website (there might be multiple files).

Then you need to check their contents for configuration lines:

  • ssl_certificate which will point to the certificate chain (fullchain.pem)
  • ssl_certificate_key which will point to the private key (privkey.pem).

Finally you should use openssl command to extract the public key from the certificate chain file:

openssl rsa -in <path_to_privkey.pem> -pubout > key.pub
  • how to get the public key with BEGIN CERTIFICATE and END CERTIFICATE format. @techraf
    – Dolphin
    Dec 17, 2021 at 9:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .