Tôi muốn tạo máy chủ https cho máy chủ cục bộ của mình.
Tài liệu Node JS cung cấp giải pháp hộp nhưng tôi có chút nhầm lẫn với nó. Ví dụTạo máy chủ HTTPS với nút js
var https = require('https');
var fs = require('fs');
var options = {
key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
};
https.createServer(options, function (req, res) {
res.writeHead(200);
res.end("hello world\n");
}).listen(8000);
Hoặc
var options = {
pfx: fs.readFileSync('server.pfx')
};
đây làm thế nào tôi sẽ nhận được chìa khóa, cert hoặc PFX cho localhost của tôi?