NodeJS使用SSL证书

Posted 天空之城

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了NodeJS使用SSL证书相关的知识,希望对你有一定的参考价值。

[From] https://segmentfault.com/q/1010000004705326

 

var options = {
    key: fs.readFileSync(‘../ssl/private.key‘,‘utf8‘),
    cert: fs.readFileSync(‘../ssl/certificate.crt‘,‘utf8‘),
    ca: fs.readFileSync(‘../ssl/ca_bundle.crt‘,‘utf8‘)
};

http.createServer(app).listen(3000);
https.createServer(options, app).listen(3001);

 

以上是关于NodeJS使用SSL证书的主要内容,如果未能解决你的问题,请参考以下文章