title: nginx SSL no start line: expecting: TRUSTED CERTIFICATE
body: <p>I'm out of ideas and I need help please! </p>
  
  <p>I create my SSL using Openssl with this:</p>
  
  <pre><code>openssl req -x509 -newkey rsa:4096 -sha256 -nodes -keyout key.pem -out cert.pem -days 3650
  </code></pre>
  
  <p>The cert.pem looks like this:</p>
  
  <pre><code>-----BEGIN CERTIFICATE-----
  cert
  -----END CERTIFICATE-----
  </code></pre>
  
  <p>The key.pem looks like this:</p>
  
  <pre><code>-----BEGIN PRIVATE KEY-----
  key
  -----END PRIVATE KEY-----
  </code></pre>
  
  <p>In docker-compose I have the cert/key sent to etc/nginx/ssl/...</p>
  
  <pre><code>volumes:
    - ./sites:/etc/nginx/conf.d
    - ./conf/nginx.conf:/etc/nginx/nginx.conf
    - ./ssl/cert.pem:/etc/nginx/ssl/cert.pem
    - ./ssl/key.pem:/etc/nginx/ssl/key.pem
  </code></pre>
  
  <p>In nginx I have it added like this:</p>
  
  <pre><code>  listen    443 ssl;
    server_name       localhost;
    ssl_certificate   ssl/cert.pem;
    ssl_certificate_key   ssl/key.pem;
  </code></pre>
  
  <p>When I start up docker-compose, I get this error with nginx:</p>
  
  <pre><code>web_1    | 2018/08/17 16:38:47 [emerg] 1#1: PEM_read_bio_X509_AUX("/etc/nginx/ssl/cert.pem") failed (SSL: error:0906D06C:PEM routines:PEM_read_bio:no start line:Expecting: TRUSTED CERTIFICATE)
  web_1    | nginx: [emerg] PEM_read_bio_X509_AUX("/etc/nginx/ssl/cert.pem") failed (SSL: error:0906D06C:PEM routines:PEM_read_bio:no start line:Expecting: TRUSTED CERTIFICATE)
  </code></pre>
  
  <p>I've been working on this for several days now and I'm not sure why I keep getting this error. I've tried making it crt/key instead of .pem and I get the same error. If I just remove ssl all together the server works fine, but I need SSL very badly. Pleeeaaase help!</p>