我正在尝试使用 greenlock-express 来测试使用 ssl 提供应用程序。我在这里关注文档:
所以我有app.js:
"use strict";
// Here's a vanilla HTTP app to start,
// but feel free to replace it with Express, Koa, etc
var app = function (req, res) {
res.end("Hello, Encrypted World!");
};
module.exports = app;
我有server.js:
"use strict";
var app = require("./app.js");
require("greenlock-express")
.init({
packageRoot: __dirname,
// contact for security and critical bug notices
maintainerEmail: "my_email@gmail.com",
// contact for security and critical bug notices
configDir: "./greenlock.d",
// whether or not to run at cloudscale
cluster: false,
})
// Serves on 80 and 443
// Get's SSL certificates magically!
.serve(app);
我使用了这个命令:
npx greenlock init --config-dir ./greenlock.d --maintainer-email 'my_email@gmail.com'
这个命令:
npx greenlock add --subject my_website.online --altnames my_website.online
这生成了greenlock.d文件夹:config.json
{
"defaults": {
"store": {
"module": "greenlock-store-fs"
},
"challenges": {
"http-01": {
"module": "acme-http-01-standalone"
}
},
"renewOffset": "-45d",
"renewStagger": "3d",
"accountKeyType": "EC-P256",
"serverKeyType": "RSA-2048",
"subscriberEmail": "my_email@gmail.com"
},
"sites": [
{
"subject": "my_website.online",
"altnames": [
"my_website.online",
"www.my_website.online"
],
"renewAt": 1
}
]
}
但是,当我尝试访问该应用程序时,我看到的是:
我遵循教程中的确切步骤,所以我不明白为什么这不起作用。
有什么想法吗?