简体   繁体   English

在 Express (Node js) 上安装 SSL 证书

[英]Installing a SSL Certificate on Express (Node js)

im trying to setup a AlphaSSL WildCard Certificate on a express server on a sub-domain我正在尝试在子域的快速服务器上设置 AlphaSSL 通配符证书

I'm trying start a blank app on ssl like so:我正在尝试在 ssl 上启动一个空白应用程序,如下所示:

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但是页面返回给我一个 ERR_EMPTY_RESPONSE,如果我在 createServer 上传递我的最终应用程序,并且没有 ssl,则相同

Probably You do not need to use 'utf8' parameter for SSL keys while reading files.在读取文件时,您可能不需要对 SSL 密钥使用 'utf8' 参数。 The need to get byte array as content, not a string.需要获取字节数组作为内容,而不是字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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