我正在尝试使用express.js框架服务器在node.js上安装comodo ssl证书,但它无法正常工作。 我从comodo获得了4个crt文件。 我正在尝试以下步骤:
var express = require('express'),
fs = require("fs"),
https = require("https");
var options = {
key: fs.readFileSync('/opt/mytestserver.key'),
cert: fs.readFileSync('/opt/mytest.crt'),
ca: fs.readFileSync("/opt/mytestbundle.crt")
};
var server = https.createServer(options, app);
请帮忙。
答案 0 :(得分:1)
在为自己寻找解决方案时发现这个没有答案 希望这有助于某些人 - 我知道它在OP之后。
我能够通过使用我的初始私钥和我在电子邮件中收到的Comodo域证书创建一个文件夹(我将其命名为certs)来实现它。我确实将zip文件中的其他3个证书复制到certs文件夹中。
...
var credentials = {
key: fs.readFileSync('certs/privatekey.pem'),
cert: fs.readFileSync('certs/mydomainkeyfromcomodo.crt'),
};
// =============================================================================
// Start the server
// =============================================================================
var https = require('https');
var server = https.createServer(credentials, app);
server.listen(app.get('port'), function() {
console.log('Server up on port ' + app.get('port'));
});
希望这有帮助。