[Solved] 使用Certbot工具 http-01 SSL 自動更新 Let’s encrypt 錯誤處理 (Missing command line flag or config entry for this setting) for Windows
Published:
by .此情況是自身在操作自架伺服器時,為了使用HTTPS(超級文字傳輸安全協定),透過certbot + openssl 產生了SSL的相關憑證後的問題解決方案,紀錄以便之後發生問題的自己,可以快速查閱,若您也遇到相同問題並解決,不妨留個言支持一下!
-
這邊不教學任何設定Let’s encrypt SSL憑證的教學。
Certbot 測試自動更新憑證指令
certbot renew --dry-run
而我卻沒有那麼幸運的成功執行… 出現了以下的錯誤
C:\Certbot\live\WEBSITENAME> certbot renew --dry-run
Saving debug log to C:\Certbot\log\letsencrypt.log
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing C:\Certbot\renewal\WEBSITENAME.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Simulating renewal of an existing certificate for WEBSITENAME.com.tw
Failed to renew certificate WEBSITENAME.com.tw with error: Missing command line flag or config entry for this setting:
Input the webroot for WEBSITENAME.com.tw:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
All simulated renewals failed. The following certificates could not be renewed:
C:\Certbot\live\WEBSITENAME.com.tw\fullchain.pem (failure)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1 renew failure(s), 0 parse failure(s)
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile C:\Certbot\log\letsencrypt.log or re-run Certbot with -v for more details.
如果你有耐心看的話,我發生了一個悲劇,「Failed to renew certificate Error: Missing command line flag or config entry for this setting」,這個問題我當時其實2022年3月份就遇到了,不過因為當時忙碌沒有去解決它,當我很著重在看這個錯誤時,我遺漏的renewal\WEBSITENAME.conf這個檔案….。想不到,問題就是出在這裡!!
此時打開你的 C:\Certbot\renewal\WEBSITENAME.conf
正確格式如下:
如果你少了 [[]webroot_map]],加上去就對了….
C:\nginx\html 是你前端檔案的位置->挑戰http-01
然後可以執行:
certbot renew --dry-run
C:\Certbot\live\WEBSITENAME> certbot renew --dry-run
Saving debug log to C:\Certbot\log\letsencrypt.log
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing C:\Certbot\renewal\WEBSITENAME.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Simulating renewal of an existing certificate for WEBSITENAME.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations, all simulated renewals succeeded:
C:\Certbot\live\WEBSITENAME\fullchain.pem (success)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -