Let's Encrypt 自动续期的证书 nginx 不会自动刷新

2018-03-05 09:44:59 +08:00
 ColinZeb
怎么解决,难道要在续期证书的时候执行 reload 吗
10444 次点击
所在节点    NGINX
38 条回复
linxu
2018-03-05 09:47:50 +08:00
crontab,重启 nginx
SEARCHINGFREE
2018-03-05 09:50:35 +08:00
周一凌晨 3 点半 restart (
wweir
2018-03-05 09:52:47 +08:00
--dry
shooyaaa
2018-03-05 09:55:06 +08:00
nginx -s reload
tammy
2018-03-05 09:58:27 +08:00
@shooyaaa #4 restart 才会重新读取证书吧
mikulch
2018-03-05 10:09:39 +08:00
哎?我记得以前我使用 docker 的 nginx 与 let's Encrypt 是可以自动刷新证书的呢。
sujin190
2018-03-05 10:12:23 +08:00
肯定需要 reload 啊,nginx 启动的时候所有需要的配置就已经被加载到内存了,如果每次请求去读那还不慢死了,你不 reload nginx 怎么知道你要重新加载的啊
BOYPT
2018-03-05 10:13:21 +08:00
神器 caddy 了解一下
ColinZeb
2018-03-05 10:14:36 +08:00
@sujin190 我在想证书的 cron 里能不能加一条 reload 的命令
ColinZeb
2018-03-05 10:15:45 +08:00
@BOYPT 不熟悉这个。不能只因为证书就换掉 nginx 吧
lanjz
2018-03-05 10:17:56 +08:00
> 在 NGINX 上配置 HTTPS---血的教训

http://www.cnblogs.com/aguncn/p/4237083.html
jessynt
2018-03-05 10:19:56 +08:00
certbot 的话可以用 post-hook
ColinZeb
2018-03-05 10:20:00 +08:00
@lanjz 如果只是更新证书应该是 reload 就行了吧,我记得我上次就是 reload 解决的。
ColinZeb
2018-03-05 10:20:36 +08:00
@jessynt 我用的 acme.sh 我查了文档没查到相关说明
BOYPT
2018-03-05 10:21:35 +08:00
@ColinZeb #10 我就是因为证书就换掉 nginx 的。

另外你以为各种 certbot、acme 的 post hook 是干嘛用的?
lanjz
2018-03-05 10:23:13 +08:00
@ColinZeb 我以前一直是 reload 的,确实大部分情况下 reload 没问题。不过前几天出了一个 https 的奇怪的问题,各种
nginx -s reload 都没生效。最后 nginx -s stop && nginx 后解决了。然后搜了下看到了那个,没有深入研究。
rrfeng
2018-03-05 10:23:36 +08:00
reload 即可
jlkm2010
2018-03-05 10:28:29 +08:00
用的 traefik,爽歪歪
jessynt
2018-03-05 10:28:41 +08:00
sunny00123
2018-03-05 10:50:45 +08:00
# /etc/cron.d/certbot: crontab entries for the certbot package
#
# Upstream recommends attempting renewal twice a day
#
# Eventually, this will be an opportunity to validate certificates
# haven't been revoked, etc. Renewal will only occur if expiration
# is within 30 days.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

0 */12 * * * root certbot renew --quiet --rsa-key-size 4096 --must-staple --post-hook "/etc/init.d/nginx reload"

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/434833

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX