For origin certificate, nginx give "expecting trusted certificate" error

What is the name of the domain?

What is the error message?

nginx: [emerg] cannot load certificate “/cert.pem”: PEM_read_bio_X509_AUX() failed (SSL: error:0480006C:PEM routines::no start line:Expecting: TRUSTED CERTIFICATE)

What is the issue you’re encountering

nginx won’t recognize cloudflare origin certificate

Was the site working with SSL prior to adding it to Cloudflare?

No

What is the current SSL/TLS setting?

Full (strict)

Can you share the nginx configuration, where you’re having this problem?

Here is nginx configuration, in /etc/nginx/conf.d/:

server {
listen 80;
listen [::]:80;

return 301 https://$host$request_uri;

}

server {
listen 443 ssl;
listen [::]:443 ssl;

ssl_certificate /cert.pem;
ssl_certificate_key /key.pem;

location / {
    proxy_pass http://xxx:8365;
}

}

nginx won’t start and keep restarting because of this error, and log shows this error

  1. Is there any chance you (by accident) have switched around the two files, "cert.pem and “key.pem”, and therefore are loading the key as being the certificate, and the certificate as being the key?

  2. Is the cert.pem file starting with “-----BEGIN CERTIFICATE-----” and ending with “-----END CERTIFICATE-----”?

  3. Is the key.pem file starting with “-----BEGIN PRIVATE KEY-----” and ending with “-----END PRIVATE KEY-----”?

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.