最近網站的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
到這一步,我再去訪問我的網址已經可行了。只是說明以前配置的自動更新證書的配置為什么沒有生效?
