0

我在“greenlock.d/live/URL_PATH/”中有 CA 证书文件。它的到期日期是 2022 年 8 月。

但是我现在想更新它们以检查它们是否在更新。请建议我如何随时更新它们?

我做了什么:

我尝试了多种解决方案,例如:

  • 尝试了一些命令
  • 在“greenlock.d/config.json”中更改更新时间(“renewAt”)

代码:

应用程序.js

'use strict';

var app = function(req, res) {
    res.end('Hello, Encrypted World!');
};

module.exports = app;

服务器.js

'use strict';

var beapp = require('./app.js');

require('greenlock-express')
    .init({
        packageRoot: __dirname,
        maintainerEmail: "EMAIL_ID",
        configDir: './greenlock.d',
        cluster: true
    })
    // .serve(beapp);
    .ready(httpsWorker);
function httpsWorker(glx) {
    var httpsServer = glx.httpsServer(null, beapp);
    httpsServer.listen(443, "0.0.0.0", function () {
        console.info("Listening on ", httpsServer.address());
    });
}

greenlock.d/config.json

{
  "defaults": {
    "store": {
      "basePath": "./greenlock.d",
      "module": "greenlock-store-fs"
    },
    "challenges": {
      "http-01": {
        "module": "acme-http-01-standalone"
      }
    },
    "renewOffset": "-45d",
    "renewStagger": "3d",
    "accountKeyType": "EC-P256",
    "serverKeyType": "RSA-2048",
    "subscriberEmail": "EMAIL_ID"
  },
  "sites": [
    {
      "subject": "URL_PATH",
      "altnames": [
        "URL_PATH"
      ],
      "renewAt": 1
    }
  ]
}
4

1 回答 1

0
  • 按顺序运行这些命令:
  1. npm 初始化
  2. npm install --save greenlock-express@v4
  3. npx greenlock init --config-dir ./greenlock.d --maintainer-email 'jon@example.com'
  4. npx greenlock add --subject example.com --altnames example.com
  5. 节点服务器.js

参考:https ://www.npmjs.com/package/greenlock-express#1-create-your-project

于 2022-01-05T10:08:57.547 回答