[精讚] [會員登入]
1023

Let's encrypt 在 FreeBSD 裡自動更新的方式

稍早收到 Let's Emcrypt 的 E-mail 通知, 說我的憑證有效期剩 19 天, 要趕快更新。 這

分享此文連結 //n.sfs.tw/13686

分享連結 Let's encrypt 在 FreeBSD 裡自動更新的方式@杜子的網管筆記
(文章歡迎轉載,務必尊重版權註明連結來源)
2019-10-23 07:43:24 最後編修
2019-10-17 17:41:04 By 杜子
 

稍早收到 Let's Emcrypt 的 E-mail 通知, 說我的憑證有效期剩 19 天, 要趕快更新。

 

這個方法在我的 FreeBSD 11 已驗證有效確實可自動更新

1. 建立一個 renew_letsencrypt.sh 檔案

#!/bin/sh
if ! /usr/local/bin/letsencrypt/letsencrypt-auto certonly --renew-by-default --agree-tos --webroot --email youremail@mail.edu.tw -w /usr/local/www/apache24/data/www/web -d www.fnjh.tc.edu.tw > /var/log/letsencrypt/renew.log 2>&1 ; then
echo Automated renewal failed:
cat /var/log/letsencrypt/renew.log
exit 1
fi
service apache24 restart

-w 是指網站根目錄

-d 是註冊的網址

--email 後面要加管理員的 email 

2.把這個檔案設為可執行

chmod 700 renew_letsencrypt.sh

3. 加入自動執行的指令

在 /etc/crontab 裡的寫法, 每兩個月的某日某時某分, 自動跑一次更新 ,下面這個例子是指每 2,4,6,8,10,12 月的 17 日 17:20 進行

20   17  17  2,4,6,8,10,12   *   root    /root/renew_letsencrypt.sh

4. 要確認執行有沒有成功, 可以從 /var/log/letsencrypt/renew.log 查詢 log 檔

END

你可能感興趣的文章

MariaDB 的效能調整筆記 因應臺中市網路應用競賽的需求, 自己開發了一套校內初賽專用的系統, 因為是比賽的系統,所以會有短時間大量同時登入的情況,

Let's encrypt 在 FreeBSD 裡自動更新的方式 稍早收到 Let's Emcrypt 的 E-mail 通知, 說我的憑證有效期剩 19 天, 要趕快更新。 這

隨機好文

檔案無法刪除?! 我的 Server 的作業系統都是 FreeBSD,剛剛在修改某支程式後發現無法儲存, 甚至連刪除都不行,會出現 Ope

Windows Active Directory 啟動 LDAPS 連線 重架了 Windows Server 2016 也安裝了 Windows AD 服務, 當網域伺服器架好, 預設的 38

利用 Composer 建立 Yii2 專案 最近由於學校的網路架構調整及更新所有的個人電腦作業系統為 Win 10 , 讓我忙得不可開交, 偏偏 sfs3 此時在台

讓 Windows Server 2016 的 IIS 10 支援 PHP 因為在研究如何利用 PHP 與 Windows AD 進行 LDAPS 連線,外部的 Linux 或 FreeBSD 跑