1. 程式人生 > >https證書過期問題

https證書過期問題

conf 一個 查看 tails 繼續 png 還需 文章 etc

這個是以前配置證書的文章,同時更新證書的有效的一篇文章

最近網站的https證書過期了,造成無法對外提供服務,懷疑是當時配置的自動更新沒有起作用。

技術分享圖片

然後去後臺更新https證書,卻遇到了問題,使用的具體命令和報錯信息:

sudo certbot renew --dry-run  
Attempting to renew cert (cloudappservice.top) from /etc/letsencrypt/renewal/cloudappservice.top.conf 
produced an unexpected error: Could not automatically find a matching server block. 
Set the `server_name` directive to use the Nginx installer.. Skipping

技術分享圖片

這樣看來自動更新是不行的,繼續新的方法

1.sudo service nginx stop  

這裏事先停止掉nginx服務,以免後面因為占用而無法更新

2.sudo certbot --force-renewal  

執行這一步會強制更新證書,過程中會有一個選項,這個具體是哪一個忘記了,這裏還需要日後確認下。在這個命令執行完之後,多出來了2個文件cloudappservice.top-001/fullchain.pem cloudappservice.top-001/privkey.pem.其實這個時候去我們之前配置的反向代理文件中查看的話,這兩個最新的文件已經自動更新替換原來的證書文件了。

技術分享圖片

3.重新啟動nginx服務

sudo cerbot nginx start  

到這一步,我再去訪問我的網址已經可行了。只是說明以前配置的自動更新證書的配置為什麽沒有生效?  

https證書過期問題