

解决 certbot 无法更新证书问题
source link: https://azhuge233.com/%e8%a7%a3%e5%86%b3-certbot-%e6%97%a0%e6%b3%95%e6%9b%b4%e6%96%b0%e8%af%81%e4%b9%a6%e9%97%ae%e9%a2%98/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

下文并没有根本上解决端口绑定的问题,只是换了一种获取/更新证书的方式,绕过了端口绑定
- certbot
- Ubuntu 16.04
certbot 更新证书,执行
certbot renew --dry-run
Encountered exception during recovery: certbot.errors.MisconfigurationError: nginx restart failed:
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
Attempting to renew cert (xxx.com) from /etc/letsencrypt/renewal/xxx.com.conf produced an unexpected error: nginx restart failed:
参考太多了,不整理了
说法不一,一共两种理解(本人理解并不透彻,还需要进一步分析 certbot 的运行方式):
- certbot 使用了 standalone 的验证模式,验证时需要开启一个单独的 (nginx)webserver,而运行中的网站已经开启了 nginx 并绑定了 80、443 端口,导致 certbot 的 webserver 无法绑定端口 -> 无法完成验证 -> 无法更新证书
- 如果先关闭网站的 nginx,网站则无法运行,后续 certbot 会访问网站的 .well-known 目录来验证网站管理权限,这时又会报错无法访问 .well-known/acme-challenge
- certbot 更新完证书后,无法重启 nginx,所以产生了 nginx restart failed 错误
- 通过 –pre-hook 和 –post-hook 参数调整 nginx 关闭/开启命令后,仍然报相同错误
- 不了解这两个参数可以自行百度,作用为自定义 certbot 更新证书前/后执行的指令
因为我只是想定期自动更新 let’s encrypt 证书,没有其他需求,所以最终选择使用 webroot 的验证方式,这样 certbot 就不会启动 webserver,从而解决报错问题
- 命令行执行,测试更新证书
certbot certonly --dry-run -n --webroot -d 你的域名.com -d www.你的域名.com --webroot-path /你的/网站/目录
certbot certonly --dry-run -n --webroot -d 你的域名.com -d www.你的域名.com --webroot-path /你的/网站/目录
- 去掉 –dry-run 更新证书
certbot certonly -n --webroot -d 你的域名.com -d www.你的域名.com --webroot-path /你的/网站/目录
certbot certonly -n --webroot -d 你的域名.com -d www.你的域名.com --webroot-path /你的/网站/目录
- 编辑 /etc/cron.d/certbot,更新 renew 命令
Recommend
-
269
website upgrading… 京ICP备110065...
-
48
解决 OpenVPN 证书过期问题 August 1, 2021 • Read: 32 •
-
13
使用 certbot 代替 acme.sh 免费申请 wildcard 通配符证书和自动更新实践小结因为 Google Chrome 和运营商劫持干扰访问者体验的努力推动了大型网站加速应用全站 HTTPS,而 Let’s Encrypt 这个项目通过自动化把配置和维...
-
7
使用acme.sh更新不了证书的问题解决 最近使用acme.sh更新证书的时候,一直出现这个错误提示: Please refer to https://curl.haxx.se/libcurl/c/libcurl-errors.html for error code: 60 找了下问...
-
10
使用 certbot 一键申请泛域名解析证书 Let's Encrypt 现在已经支持免费的泛域名证书了。之前为 u.sbw.so 及 blog.sbw.so 等申请了好几个证书,由于申请时间不同,所以续期的时间也不同步,这样管理起来比较费事,所以最近索性全部换成了同一...
-
9
使用certbot自动给通配符证书续期 今晚发现 hellodk.com 的几个网站的证书过期(比如 https://router.hellodk.com )无法访问,然后续期证书遇到问题,本文记...
-
5
Access denied Access denied Error code 1020 You do not have access to azhuge233.com.The site owner may have set restrictions that prevent you from accessing the site. Contact the site owner for ac...
-
8
let's encrypt 如何用certbot删除一个证书 2022-01-01 08:17:52 ...
-
12
Centos 下更新 CA 证书,解决 wget 和 curl 请求 https 异常的问题 VPS小白 >
-
5
群晖7.1版本syno-acme.sh自动更新证书脚本,及无法更新的解决方法 - NixonLi博客
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK