大网数据广告活动
服务器运维问答

Renew letsencrypt certificate on Apache httpd

· 52CE 我爱测

I'm using certbot --webroot plugin and certbot renew to renew the certificate, which does work, but it looks like httpd is caching the certificate and does not "see" that it's been updated. Is there a signal for httpd to reload t…

问题原文

原帖链接 · rustyx · CC BY-SA 3.0

I'm using certbot --webroot plugin and certbot renew to renew the certificate, which does work, but it looks like httpd is caching the certificate and does not "see" that it's been updated.

Is there a signal for httpd to reload the certificates?

p.s. I prefer not to restart httpd to avoid downtime.

已采纳解答

原帖链接 · gene_wood · CC BY-SA 3.0

To get httpd to notice the new certificates you need to request that it do a "graceful restart". From the docs :

The USR1 or graceful signal causes the parent process to advise the children to exit after their current request (or to exit immediately if they're not serving anything). The parent re-reads its configuration files and re-opens its log files. As each child dies off the parent replaces it with a child from the new generation of the configuration, which begins serving new requests immediately.

As such a graceful restart won't cause downtime.

In order to get letsencrypt/certbot to trigger a graceful restart use the --post-hook argument. This argument will run a command once if any cert renewal was attempted. From the docs:

Command to be run in a shell after attempting to obtain/renew certificates. Can be used to deploy renewed certificates, or to restart any servers that were stopped by --pre-hook. This is only run if an attempt was made to obtain/renew a certificate. (default: None)

So the command you would want is

certbot renew --post-hook "apachectl graceful"

or if run from a cron job

certbot renew --quiet --post-hook "apachectl graceful"

(Thanks to @RustyX for help with this answer)

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-08-09)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。