Score:0

SSL with NGINX with .pem files

na flag

I need to add SSL certificate for my domain for my website on my NGINX server.

My domain provider gave me a zip file to download, which contains:

domain.cert.pem
intermediate.cert.pem
private.key.pem
public.key.pem

[For clarity: I did not rename 'domain', it is called domain.cert.pem]

I'm confused as to what to do, because all the tutorials I can find online require different files, some ending with .crt.

Does anyone have any advice?


My nginx conf:

server {
  listen 80 default_server;
  ssl on;
  server_name mydomain.com;

  ssl_certificate /usr/src/app/domain.cert.pem;
  ssl_certificate_key /usr/src/app/private.key.pem;

  # vue app & front-end files
  location / {
    root /usr/src/app/dist;
    try_files $uri /index.html;
  }

  # node api reverse proxy
  location /api/ {
    proxy_pass http://localhost:4000/;
  }
}

Error when restarting nginx:

nginx: [emerg] PEM_read_bio_X509("/usr/src/app/domain.ce
Score:1
ke flag

cat intermediate.cert.pem >> domain.cert.pem

In your nginx conf:

server {
    ...
    ssl_certificate     /path/to/domain.cert.pem;
    ssl_certificate_key /path/to/private.key.pem;
    ...
}
Joseph avatar
na flag
Hi @Alaister, I followed your instructions but now I get an error when I restart nginx, I have copied the error and my conf file to my main post
ke flag
@Joseph Could you please show the full error message? Thanks.
Joseph avatar
na flag
solved it! I found this post, my concatenated domain.cert.pem file didn't have a new line between the two keys. I added a line break and it works. Thank you very much for your help. https://stackoverflow.com/questions/62514704/ssl-on-nginx-throws-error-ssl-error0908f066pem-routinesget-header-and-data
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.