格林洛克管理器
管理 SSL 证书的签发和续签 绿锁。 。 。 .
将全局和每个站点的配置保存到本地文件 Sytem (当前), 并带有可选的加密 Cloud 备份( 即将到来) .
安装
npm install --save greenlock@4
npm install --save greenlock-manager@3
使用量
要启用加密云备份, 当可用时:
npx greenlock init --manager cloud --config-dir './greenlock.d'
只针对本地文件系统 :
npx greenlock init --manager fs --config-dir './greenlock.d'
或者,把这个文件放在您的工程的根中 :
.greenlockrc数字 :
{
"manager": { "module": "@greenlock/manager" },
"configDir": "./greenlock.d"
}
格林洛克管理器 CLI 和 API
所有管理器插件都有 同样的 API。 。 。 .
由Greenlock负责具体管理人员的实施工作, 然后按这里的记录曝光.
说明:大多数人不需要(也不应该)不使用JavaScript API. 相反,使用CLI(当前)或Web API(即将到来).
初始化管理器
npx greenlock init --manager cloud --config-dir './greenlock.d'
说明:你 不应该 将绿锁直接初始化为 这可能使它与CLI和Web GUI不相容.
使用 CLI 生成的文件 init (上下扬.
Greenlock.create({
manager: "@greenlock/manager",
cloud: true,
configDir: "./greenlock.d",
packageRoot: __dirname
});
设置订阅者和其他全局默认值
npx greenlock defaults --subscriber-email [email protected] --agree-to-terms true
greenlock.manager.defaults({
subscriberEmail: "[email protected]",
agreeToTerms: true
});
场地管理
通过"现场",我们是指一个主域, 和,可选的,次要域, 要在 ssl 证书上列出, 以及获取和延长这些证书所需的任何配置.
添加站点 - 域和 SSL 证书
npx greenlock add --subject example.com --altnames 'example.com,www.example.com'
greenlock.sites.add({
subject: "example.com",
altnames: ["example.com", "www.example.com"]
});
查看站点配置
npx greenlock config --subject example.com
greenlock.sites.get({
servername: "www.example.com",
wildname: "*.example.com"
});
更新网站配置
npx greenlock update --subject example.com --challenge-dns-01 acme-dns-01-ovh --challenge-dns-01-token xxxx
greenlock.sites.update({
subject: "www.example.com",
challenges: {
"dns-01": {
module: "acme-dns-01-ovh",
token: "xxxx"
}
}
});
删除一个站点
停止对特定站点自动更新 SSL 证书 .
要重新开始更新, 您必须使用 add()。 。 。 .
npx greenlock remove --subject example.com
greenlock.sites.remove({
subject: "example.com"
});