如何在 node.js 应用程序中正确安装 SSL?
How properly install SSL in a node.js application?
我在这里遇到问题,当我测试我的 SSL 时出现此消息:
Certificate chain is incomplete.
我已经在我的入口点文件中创建了 http 和 https 服务器,并且 运行 在某些浏览器中没有问题,但在其他浏览器中出现消息说该站点不安全,因为链不完整.
如何正确安装 SSL 以使链完整?
我是这样做的:
SSL FOLDER
|- credentials.js
|- site.pem
|- site-cert.pem
|- site-ca.pem
在我的 credentials.js 我有:
var fs = require('fs');
var credentials = {
key: fs.readFileSync(__dirname + '/mysite.pem', 'utf8'),
cert: fs.readFileSync(__dirname + '/mysite-cert.pem', 'utf8'),
ca: fs.readFileSync(__dirname + '/mysite-ca.pem', 'utf8'),
passphrase: 'secretphrase'
};
module.exports = credentials;
在我的入口点我有:
var app = require('../app');
var http = require('http');
var https = require('https');
var credentials = require('./ssl/credentials');
http.createServer(app).listen(3000, app.get('ip'), function() {
console.log('Running on port 3000, in ' + app.get('env') + ' mode.');
});
https.createServer(credentials, app).listen(443, app.get('ip'), function() {
console.log('Running on port 443, in ' + app.get('env') + ' mode.');
});
也许我忘记了什么?
我不明白链条的问题。
您可能需要添加链接到根 CA 证书的中间 CA 证书。参见
使用在线 SSL 测试工具检查您的域,查看链中的所有证书是否都由您的服务器发送。
我在这里遇到问题,当我测试我的 SSL 时出现此消息:
Certificate chain is incomplete.
我已经在我的入口点文件中创建了 http 和 https 服务器,并且 运行 在某些浏览器中没有问题,但在其他浏览器中出现消息说该站点不安全,因为链不完整.
如何正确安装 SSL 以使链完整?
我是这样做的:
SSL FOLDER
|- credentials.js
|- site.pem
|- site-cert.pem
|- site-ca.pem
在我的 credentials.js 我有:
var fs = require('fs');
var credentials = {
key: fs.readFileSync(__dirname + '/mysite.pem', 'utf8'),
cert: fs.readFileSync(__dirname + '/mysite-cert.pem', 'utf8'),
ca: fs.readFileSync(__dirname + '/mysite-ca.pem', 'utf8'),
passphrase: 'secretphrase'
};
module.exports = credentials;
在我的入口点我有:
var app = require('../app');
var http = require('http');
var https = require('https');
var credentials = require('./ssl/credentials');
http.createServer(app).listen(3000, app.get('ip'), function() {
console.log('Running on port 3000, in ' + app.get('env') + ' mode.');
});
https.createServer(credentials, app).listen(443, app.get('ip'), function() {
console.log('Running on port 443, in ' + app.get('env') + ' mode.');
});
也许我忘记了什么?
我不明白链条的问题。
您可能需要添加链接到根 CA 证书的中间 CA 证书。参见
使用在线 SSL 测试工具检查您的域,查看链中的所有证书是否都由您的服务器发送。