节点/表达式-错误:0906D06C:PEM例程:PEM_read_bio:运行https服务器时没有起始行

时间:2019-07-05 09:58:55

标签: node.js express ssl https

我正在https server应用中创建一个express,并且在启动该应用时,出现此错误:

  

错误:0906D06C:PEM例程:PEM_read_bio:无起始行

这是代码:

const https = require('https');
const privateKey  = fs.readFileSync('ssl/new/xxxx.key', 'utf8');
const certificate = fs.readFileSync('ssl/new/xxxx.crt', 'utf8');
const ca = fs.readFileSync('ssl/xxx.ca-bundle.crt', 'utf8');

const credentials = {key: privateKey, cert: certificate, ca: [ca]};

const server = https.createServer(credentials, app);
server.listen(appConfig.port);
server.on('error', onError);
server.on('listening', onListening);

0 个答案:

没有答案