title: Nginx - setting up SSL with existing .crt, .key and CA.pem files
body: <p>I have a <code>.crt</code>, <code>.key</code> and <code>CA.pem</code> files that were generated <a href="https://pastebin.com/Jzk7gSRh" rel="nofollow noreferrer">like this</a>.</p>
  
  <p>These certs are kind of project-wide, and they work when firing up a <a href="https://webpack.js.org/configuration/dev-server/#devserver-https" rel="nofollow noreferrer">webpack-dev-server</a> server on HTTPS like:</p>
  
  <pre><code>devServer: {
    https: {
      key: fs.readFileSync('/path/to/example.com.key'),
      cert: fs.readFileSync('/path/to/examle.com.crt'),
      ca: fs.readFileSync('/path/to/CA.pem'),
    }
  }
  </code></pre>
  
  <p>Now I need to setup an Nginx server using these 3 files, but I've been trying with no luck. Here's my config:</p>
  
  <pre><code>server {
      listen       3000;
  
      ssl_certificate certs/example.com.crt;
      ssl_certificate_key certs/example.com.key;
  
      # where does the CA.pem file go??
  }
  </code></pre>
  
  <p>The result of this is Chrome giving me a</p>
  
  <pre><code>This site can’t provide a secure connection 
  example.com sent an invalid response.
  ERR_SSL_PROTOCOL_ERROR
  </code></pre>
  
  <p>Nginx logs show random hex characters:</p>
  
  <pre><code>172.18.0.1 - - [14/Dec/2018:18:01:55 +0000] "\x16\x03\x01\x00\xDD\x01\x00\x00\xD9\x03\x03\xAB\xE1\xB3\x1F\xCE\x02\x02\xC5}q\xDFgd\xF1`\xC1m\x8E\x99\xCE' \x98\xDF\xDEEg\x8Fm\xED\x9F\xB1\x00\x00\x1C" 400 166 "-" "-" "-" 0.001 -
  </code></pre>
  
  <p>Any ideas what could I be doing wrong?</p>