Running SSL node.js server with godaddy gd_bundle.crt

前端 未结 4 2038
南笙
南笙 2020-12-28 16:33

I am having trouble getting my SSL server working with the certificate\'s from godaddy

Using Express: 3.1.0

Below this works with a key/crt that was

4条回答
  •  遥遥无期
    2020-12-28 17:20

    Simpler

    Why be so specific just for GoDaddy's CA bundle when you can keep the same approach for different environments? I only need two files for dev env for example but production is using GoDaddy certs and has many so what to do?

    For GoDaddy, I take their bundle and append it into a single file and name the extension as PEM as well as the key file which gives a pretty standard approach for all types of certs.

    Then you end up just doing this for all environments:

    server = https.createServer({           
        key: fs.readFileSync(config.sslKey),
        cert: fs.readFileSync(config.sslCert),
    },app).listen(config.sslPort);
    

    In your GoDaddy cert.pem file you just place your certificate and your bundle files from 1 to x (top to bottom) and you're done like so:

    -----BEGIN CERTIFICATE-----
    site certificate goes here
    -----END CERTIFICATE-----
    -----BEGIN CERTIFICATE-----
    CA 1 goes here
    -----END CERTIFICATE-----
    -----BEGIN CERTIFICATE-----
    CA 2 goes here
    -----END CERTIFICATE-----
    -----BEGIN CERTIFICATE-----
    CA X goes here
    -----END CERTIFICATE-----
    

    Not necessarily better but I prefer it. I didn't encounter on Express 3.x that I had to do the CA array route but I could be wrong for the specific version.

提交回复
热议问题