1

I'm trying to set up SSL with Nginx, however I'm having a few problems. I received all the required files, and created the bundle as shown here, and added it to my site configuration as below:

server {
    listen 443;

    server_name <domain> www.<domain>;

    ssl_certificate /srv/ssl/<domain>.bundle.cer;
    ssl_certificate_key /srv/ssl/<domain>.key;

    location / {
        proxy_pass http://localhost:4000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

server {
    listen 80;

    server_name <domain> www.<domain>;

    location / {
        rewrite ^ https://$server_name$request_uri permanent;
    }
}

When trying to connect I get an SSL connection error. However, running diff <(openssl rsa -in /srv/ssl/<domain>.key -modulus -noout) <(openssl x509 -in /srv/ssl/<domain>.bundle.cer -modulus -noout) returns nothing.

Nginx error log shows the following:

SSL_CTX_use_PrivateKey_file("/srv/ssl/<domain>.key") failed (SSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch)

The bundle was created using cat:

 cat <domain>.crt COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt > <domain>.bundle.cer

The Nginx user has permissions to read the files.

Any ideas?

4
  • What is the problem you are having? How did you create your certificate chain? It's not sufficient to link to some guide; you need to describe what you actually did. Nov 20, 2014 at 23:53
  • Added more info. As I mentioned, the problem is that you cannot establish a secure connection (Chrome shows ERR_SSL_PROTOCOL_ERROR) Nov 21, 2014 at 0:01
  • 1
    That error suggests that your private key doesn't match the certificate you are using. Did you upload the wrong file? Nov 21, 2014 at 0:04
  • Nope, files are correct. Also, if I use create a Node.js file, and use https.createServer, it works fine. Also, as you can see from diff, the files match. Nov 21, 2014 at 0:11

1 Answer 1

1

You forgot to mark the port 443 as ssl-enabled in nginx. listen 443 ssl; - kind of.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .