首页 > 解决方案 > 如何以编程方式使用 certbot 启用/禁用 SSL

问题描述

所以我正在使用 nodejs 和 nginx,我想以编程方式使用 certbot 并能够从 exec() 获取输出。

此命令应在无需用户交互的情况下生成证书:

certbot certonly --standalone --agree-tos -m my@email.com -d mydomain.com

但是我得到了很多文本,我只需要证书的路径和到期日期。

有没有办法以nodejs友好的格式获得它,比如json?

标签: javascriptnode.jssslnginxcertbot

解决方案


看着男人:https ://certbot.eff.org/docs/man/certbot.html

使用标志-n Run non-interactively

您可以使用该标志nginx来自动安装。 --nginx Obtain and install certificates using Nginx (default: False)

最后: certbot --agree-tos -n --nginx -d example.com -d www.example.com -m hello@mail.com


推荐阅读