Letsencrypt更新证书renew时出现错误produced an unexpected error: Missing command line flag or config entry

一直使用的Letsencrypt的HTTPS证书,之前都正常自动更新,今天突然收到邮件提示域名证书快过期了,于是手动执行renew结果失败,出现一堆错误信息:

Attempting to renew cert (xxx.me) from /etc/letsencrypt/renewal/xxx.me.conf produced an unexpected error: Missing command line flag or config entry for this setting:
Input the webroot for api.xxx.me:. Skipping.
...

还有其他几个域名证书全部都提示相同错误,google搜索下来几乎没有看到有相关的资料和解决办法,后来对比了其他服务器的证书配置信息发现应该是证书的配置出现了莫名其妙的错误,很奇怪。

解决办法:

打开对应的证书配置文件,路径:/etc/letsencrypt/renewal/

vi /etc/letsencrypt/renewal/xxx.me.conf

注意查看配置节点:[[webroot_map]] 下的域名与web路径是否存在且路径正确,我这里发现居然全都是空白的,一个域名都没有配置,不知道是不是 certbot-auto 版本的问题,当前出问题的版本是 0.31.0 ,我已经更新到 0.34.2

完整正确的配置格式如下:

# renew_before_expiry = 30 days
version = 0.34.2
archive_dir = /etc/letsencrypt/archive/xxx.me
cert = /etc/letsencrypt/live/xxx.me/cert.pem
privkey = /etc/letsencrypt/live/xxx.me/privkey.pem
chain = /etc/letsencrypt/live/xxx.me/chain.pem
fullchain = /etc/letsencrypt/live/xxx.me/fullchain.pem

# Options used in the renewal process
[renewalparams]
authenticator = webroot
account = e50123456cb40137cea5e88cfa3bb78b
webroot_path = /www/xxx.me/htdocs/www,
server = https://acme-v02.api.letsencrypt.org/directory
[[webroot_map]]
xxx.me = /www/xxx.me/htdocs/www
api.xxx.me = /www/xxx.me/htdocs/www

我这里就是缺少了下面这部分的配置,一个都没有,以前自动更新都是正常的,奇怪

[[webroot_map]]
xxx.me = /www/xxx.me/htdocs/www
api.xxx.me = /www/xxx.me/htdocs/www

添加上域名和对应的web根目录的绝对路径就可以了,若有多个证书则会存在多个配置文件,也这样修改,
然后再次执行 renew

/usr/local/certbot/certbot-auto renew --quiet --renew-hook "/usr/local/nginx/sbin/nginx -s reload"

现在证书已更新到最新日期了。

Letsencrypt更新证书renew时出现错误produced an unexpected error: Missing command line flag or config entry
Letsencrypt更新证书renew时出现错误produced an unexpected error: Missing command line flag or config entry

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

神神的蜗牛

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值