【发布时间】:2018-09-09 07:10:13
【问题描述】:
Certbot 和 nginx 版本:
certbot 使用certbot.eff.org 安装指南安装。
- Certbot 版本:0.22.2
- Nginx 版本:1.10.3
获取 ssl 证书可以正常工作:
certbot --nginx
但是,在更新cerbot认证时
certbot renew --dry-run
nginx启动失败导致:
nginx: [error] open() "/run/nginx.pid" failed (2: No such file or directory)
我已经尝试在/etc/letsencrypt/renewal/*com.conf/ 中更改 post-hook 和 pre-hook
- 评论
installer=nginx - 将身份验证器更改为 nginx 和独立
在/etc/letsencrypt/renewal-hooks/pre/和/etc/lestencrypt/renewal-hooks/post/中添加post和pre hook来停止和启动nginx服务。
似乎 nginx 没有正确启动或没有正确停止。 续订完成后,nginx 失败并显示 (code=exited, status=1/FAILURE)
Nginx 错误日志显示:
【问题讨论】:
-
尝试杀掉挂着的nginx
killall nginx -
之前的 nginx stater 是“sudo nginx”吗?
-
是的,当从 bash shell 启动时,nginx 命令有效。 nginx 仅在
certbot renew --dry-run上失败。我认为 certbot 在启动之前已读取 nginx.pid 。因为 pre-hook 已经停止了 nginx 服务。 -
@Larry.He 在 certbot pre-hook 中杀死 nginx?
-
我设法让它工作,将身份验证器设置为 nginx,评论 pre_hook 并将 post_hook 更改为
systemctl start nginx到/etc/letsecrypt/renewal/*.com.conf中的systemctl restart nginx。