I'm having difficult setting up SSL on nginx running on Ubuntu. I have a .pfx, .crt, and .pem cert files to work with, but the documentation is for setting it up with .crt and .key files. The code example is:

server {
    listen              80;
    listen              443 ssl;
    server_name         www.example.com;
    ssl_certificate     www.example.com.crt;
    ssl_certificate_key www.example.com.key;

I've tried to convert the files I have to these formats, but nothing works. Is there a way to use .crt or .pem with nginx without converting it to something else?


  • In which directory are you storing the cert and key? I'm not sure where nginx looks for them by default, but it appears you can use an absolute file path in the ssl_certificate directive. See ssls.com/knowledgebase/… – Stephen Ostermiller Aug 11 '20 at 18:35
  • I put the certs in the /data/ssl folder. I use the full path in the config files. – UltraJ Aug 11 '20 at 18:46
  • 1
    It doesn't matter what the files are called as long as they are in PEM format. These are text files and the first line will tell you what they do. – Richard Smith Aug 12 '20 at 6:32

Your Answer


Browse other questions tagged or ask your own question.