中使用'密碼'我目前正在使用node.js和https製作Web應用程序。 所以我嘗試使用我的.PFX(我從這裏http://www.cert-depot.com/文件)爲HTTPS所需的證明,像下面的代碼:我在我的node.js https服務器中使用.pfx證書,並且我無法在選項
var https = require('https');
var fs = require('fs');
var options = {
pfx: fs.readFileSync('./8ab20f7b-51b9-4c09-a2e0-1918bb9fb37f.pfx')
passphrase: 'password'
};
var server = https.createServer(options, function (request, response) {
fs.readFile('index.html', function (error, data) {
response.writeHead(200, {'Content-Type': 'text/html'});
response.end(data);
});
}).listen(12345, function(){
console.log('server running');
});
但是,當我開始這個代碼的node.js,我越來越在我的Windows控制檯的錯誤消息:
密碼: '密碼'
意外標識符
我的代碼與Node.js的官方指南頁面非常相似(http://nodejs.org/api/https.html#https_https_createserver_options_requestlistener),但我無法啓動我的https服務器。
我的密碼短語有什麼問題? (我在Windows 8 64位運行的node.js)
你缺少在選項逗號對象,兩者之間鍵。 – myusuf 2016-11-30 13:22:46