這節開頭的https怎么測試呢?
var?https?=?require('https') var?fs?=?require('fs') var?options??={ key:?fs.readFileSync('ssh_key.pem'),????????//私鑰文件 cert:?fs.readFileSync('ssh_cert.pem')???????//證書文件 } https .createServer(options,function(req,res)?{ res.writeHead(200) res.end('Hello?World') }) .listen(8090)
node了一下,打開8090端口發現無法訪問
而且日志信息報了個錯,說找不到ssh_key.pem
2017-06-18
ssh_key.pem這個文件不在當前運行的JS文件的目錄下,也就是“私鑰文件”和“證書文件”必須用正確的相對路徑或者絕對路徑來書寫