简体   繁体   English

如何随时强行更新greenlock-express证书?

[英]How renew greenlock-express certificates forcefully at any time?

I have CA certificates files in "greenlock.d/live/URL_PATH/".我在“greenlock.d/live/URL_PATH/”中有 CA 证书文件。 It's expiration date is Aug 2022.它的到期日期是 2022 年 8 月。

But I want to renew them right now to check whether they are renewing or not.但是我现在想更新它们以检查它们是否在更新。 Please suggest me how can I renew them at any time?请建议我如何随时更新它们?

What I have done:我做了什么:

I have tried number of solutions like:我尝试了多种解决方案,例如:

  • Tried Some commands尝试了一些命令
  • Changing renewal time ("renewAt") in "greenlock.d/config.json"在“greenlock.d/config.json”中更改更新时间(“renewAt”)

Code:代码:

app.js应用程序.js

'use strict';

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

module.exports = app;

server.js服务器.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 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
    }
  ]
}
  • Run these commands sequencially:按顺序运行这些命令:
  1. npm init npm 初始化
  2. npm install --save greenlock-express@v4 npm install --save greenlock-express@v4
  3. npx greenlock init --config-dir./greenlock.d --maintainer-email 'jon@example.com' npx greenlock init --config-dir./greenlock.d --maintainer-email 'jon@example.com'
  4. npx greenlock add --subject example.com --altnames example.com npx greenlock add --subject example.com --altnames example.com
  5. node server.js节点服务器.js

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM