簡體   English   中英

如何隨時強行更新greenlock-express證書?

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

我在“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
    }
  ]
}
  • 按順序運行這些命令:
  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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM