更新證書


#停止apache (避免port被占用) 

systemctl stop httpd

#進入目錄 (當初安裝的位置)

cd /root/letsencrypt

#更新指令 

./certbot-auto certonly --standalone -d blog.aidec.tw

#重啟apache

systemctl start httpd



2017.04.21 (添加內容 "自動更新憑證") / 2018.09.07 更新寫法


之前就想寫自動更新憑證的部分,無奈的是一直測試不出來,網路上的許多文章都測試過,但似乎與我的系統版本或letsencrypt有出入一直失敗

今天總算是測試出來了。


之前在網路上查到自動更新證書的指令

./letsencrypt-auto renew

但這串指令卻沒有效,於是我自己到 letsencrypt 安裝的位置找到了類似名稱,執行後就可以了==

./letsencrypt/letsencrypt-auto-source/letsencrypt-auto renew

接下來再到 /etc/crontab 設定定時執行 上面這串 這樣就可以自動更新證書了


#每月1、15日的3 : 00 自動更新letsencrypt-ssl證書

00 3 1,15 * *  root ./letsencrypt/letsencrypt-auto-source/letsencrypt-auto renew --apache


如果出現下面這個,表示port正被占用。例如被apache或是nginx占用住

Problem binding to port 443: Could not bind to IPv4 or IPv6.. Skipping

我們可以通過暫停apache或是nginx來解決此問題。


最近發現一個新方法,直接使用下面這個指令,添加 --nginx 這樣就能不用停止服務器也能更新SSL了。

nginx:

./letsencrypt/letsencrypt-auto-source/letsencrypt-auto renew --nginx

apache:

./letsencrypt/letsencrypt-auto-source/letsencrypt-auto renew --apache





文章轉載或引用,請先告知並保留原文出處與連結!!(單純分享或非營利的只需保留原文出處,不用告知)

原文連結:
https://blog.aidec.tw/post/Lets-encrypt-renew