Certbot 和 nginx 版本:
certbot 安装使用certbot.eff.org https://certbot.eff.org/lets-encrypt/ubuntuxenial-nginx安装指南。
- 证书机器人版本:0.22.2
- Nginx 版本:1.10.3
获取 ssl 证书效果很好:
certbot --nginx
但是,在更新 certbot 证书时
certbot renew --dry-run
nginx 无法启动导致:
nginx: [error] open() "/run/nginx.pid" failed (2: No such file or directory)
我尝试过更改 post-hook 和 pre-hook/etc/letsencrypt/renewal/*com.conf/
- 评论
installer=nginx
- 将验证器更改为 nginx 和独立版本
添加 post 和 pre 挂钩/etc/letsencrypt/renewal-hooks/pre/
and /etc/lestencrypt/renewal-hooks/post/
停止和启动 nginx 服务。
nginx 似乎没有正确启动或没有正确停止。
更新完成后,nginx 失败(code=exited,status=1/FAILURE)
Nginx 错误日志显示:
Error while certbot renew:
尝试执行:
sudo service nginx restart
然后测试您的 nginx 配置文件(直到您看到“nginx:配置文件/etc/nginx/nginx.conf测试成功")
sudo nginx -s reload -t
注意证书和其他内容的路径
然后重新加载配置而不-t
option:
sudo nginx -s reload
不建议修改配置文件/etc/letsencrypt/
但创造(如果不存在)并修改cli.ini这里的文件对我有用。您可以指定post-hook
在此文件中一次,它将适用于您的所有证书,请参阅我当前的文件:
# /etc/letsencrypt/cli.ini
max-log-backups = 0
authenticator = webroot
webroot-path = /var/www/html
post-hook = service nginx reload
text = True
我希望这对未来的读者有所帮助。解决方案来源是here https://habr.com/ru/post/318952/ (不过这篇文章是俄语的)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)