简体   繁体   中英

Installing a SSL Certificate on Express (Node js)

im trying to setup a AlphaSSL WildCard Certificate on a express server on a sub-domain

I'm trying start a blank app on ssl like so:

const options = {
       key: fs.readFileSync(__dirname + '/privatekey.pem','utf8'),
       cert: fs.readFileSync(__dirname +  '/certificate.pem','utf8'),
       ca: fs.readFileSync(__dirname +  '/intermediate.pem','utf8'),
      };


https.createServer(options, (req, res) => {
  res.writeHead(200);
  res.send('Hello World');
}).listen(80);

But the page returns me a ERR_EMPTY_RESPONSE, same if i pass my final app on the createServer, and without the ssl

Probably You do not need to use 'utf8' parameter for SSL keys while reading files. The need to get byte array as content, not a string.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM