2024-07-16

letsencrypt憑證更新後,但伺服器(nginx/apache/tomcat)不會autoreload

letsencrypt更新了憑證後,web server並不會知道憑證要重新讀取, 此時可利用letsencrypt的hooks機制,

以nginx為例,在以下路徑寫一個可執行的shell script: 
/etc/letsencrypt/renewal-hooks/deploy/01-reload-nginx 
 ============================ 
#! /bin/sh 
set -e 
nginx -t
systemctl reload nginx
============================