【環境】
● 作業系統:Windows Server 2019
● 網站平臺:IIS 10
● 憑證網站:ZeroSSL.com (Let’s Encrypt)
【步驟 – 產生 CSR】
◎開啟 IIS,選擇本機伺服器後,雙擊「伺服器憑證」。
![](https://it-help.tips/wp/wp-content/uploads/2020/03/2020-03-02-14_53_54-XD-Portal-19-172.20.8.234-Remote-Desktop-Connection-Manager-v2.7.png)
◎在空白處按右鍵,或是在右邊動作欄位選擇「建立憑證要求」。
![](https://it-help.tips/wp/wp-content/uploads/2020/03/2020-03-02-14_54_40-XD-Portal-19-172.20.8.234-Remote-Desktop-Connection-Manager-v2.7.png)
◎「一般名稱」請填入正確的網址,其餘欄位視情況填寫即可。
![](https://it-help.tips/wp/wp-content/uploads/2020/03/2020-03-02-14_55_45-XD-Portal-19-172.20.8.234-Remote-Desktop-Connection-Manager-v2.7.png)
◎依照「網路中文」的教學說明,現行的憑證都會要求位元長度要”2048″(預設是1024)。
![](https://it-help.tips/wp/wp-content/uploads/2020/03/2020-03-02-14_58_09-XD-Portal-19-172.20.8.234-Remote-Desktop-Connection-Manager-v2.7.png)
◎選擇要產生的 CSR 檔的存放位置。
![](https://it-help.tips/wp/wp-content/uploads/2020/03/2020-03-02-14_58_54-XD-Portal-19-172.20.8.234-Remote-Desktop-Connection-Manager-v2.7.png)
【步驟 – 申請憑證】
◎開啟 ZeroSSL.com,點選「ONLINE TOOLS」。
![](https://it-help.tips/wp/wp-content/uploads/2020/03/2020-03-02-17_08_43-Free-SSL-Certificates-and-Free-SSL-Tools-@-ZeroSSL-Zero-cost-SSL.png)
◎在 FREE SSL Certificate Wizard 點選「START」。
![](https://it-help.tips/wp/wp-content/uploads/2020/03/2020-03-02-17_09_07-Free-SSL-Certificates-and-Free-SSL-Tools-@-ZeroSSL-Zero-cost-SSL.png)
◎畫面左側的 Email 及 Let’s Encrypt Key 可視情況填入,亦可不填。
◎畫面右側請務必貼上前個步驟所產生的 CSR 檔內容,如果你直接輸入 Domains,讓網站自己產生 CSR,那麼待會在匯入 IIS 時,會發生問題。
◎左下角的驗證方式,可依實際狀況選擇,我是用 DNS。
![](https://it-help.tips/wp/wp-content/uploads/2020/03/2020-03-02-17_11_57-Free-SSL-Certificate-Wizard-and-other-SSL-Tools-@-ZeroSSL.png)
◎此步驟是透過 DNS 驗證的畫面,將值新增至 DNS 即可。
![](https://it-help.tips/wp/wp-content/uploads/2020/03/2020-03-02-17_17_40-Free-SSL-Certificate-Wizard-and-other-SSL-Tools-@-ZeroSSL.png)
◎完成後,即可下載憑證檔(domain certificate)。
![](https://it-help.tips/wp/wp-content/uploads/2020/03/2020-03-02-17_19_46-Free-SSL-Certificate-Wizard-and-other-SSL-Tools-@-ZeroSSL.png)
※這個步驟我原本是使用 SSL For Free 的服務,但是在匯入 CSR 那段,網站一直說我的 CSR 有問題,因此最後只好改用 ZeroSSL 才正常。
【步驟 – 匯入憑證】
◎進到 IIS 的「伺服器憑證」畫面,按右鍵選擇「完成憑證要求」。
![](https://it-help.tips/wp/wp-content/uploads/2020/03/2020-03-02-15_17_46-XD-Portal-19-172.20.8.234-Remote-Desktop-Connection-Manager-v2.7.png)
◎選擇剛剛下載的憑證檔案,並給與一個名稱。
![](https://it-help.tips/wp/wp-content/uploads/2020/03/2020-03-02-15_19_57-XD-Portal-19-172.20.8.234-Remote-Desktop-Connection-Manager-v2.7.png)
◎完成後就可以看到憑證明細。
◎建議按一下重新整理(F5),看一下憑證會不會消失,如果你在前面申請憑證的步驟沒有貼上 IIS 產生的 CSR,重新整理後就會消失。
![](https://it-help.tips/wp/wp-content/uploads/2020/03/2020-03-02-15_20_44-XD-Portal-19-172.20.8.234-Remote-Desktop-Connection-Manager-v2.7.png)
【步驟 – 使用憑證】
◎選擇目的站台,按右邊的「繫結」。
![](https://it-help.tips/wp/wp-content/uploads/2020/03/2020-03-02-15_21_39-XD-Portal-19-172.20.8.234-Remote-Desktop-Connection-Manager-v2.7.png)
◎選擇「新增」。
![](https://it-help.tips/wp/wp-content/uploads/2020/03/2020-03-02-15_22_19-XD-Portal-19-172.20.8.234-Remote-Desktop-Connection-Manager-v2.7.png)
◎選擇 “https”,輸入 “主機名稱”,最後選擇剛剛匯入的憑證,按下確定即完成。
![](https://it-help.tips/wp/wp-content/uploads/2020/03/2020-03-02-15_52_50-XD-Portal-19-172.20.8.234-Remote-Desktop-Connection-Manager-v2.7.png)
【番外篇 – 限定網站只能使用 https】
◎選擇目的站台,點選「SSL 設定」。
![](https://it-help.tips/wp/wp-content/uploads/2020/03/2020-03-02-15_54_09-XD-Portal-19-172.20.8.234-Remote-Desktop-Connection-Manager-v2.7.png)
◎勾選「需要 SSL」,再按下右邊動作視窗的「套用」即可。
![](https://it-help.tips/wp/wp-content/uploads/2020/03/2020-03-02-15_54_54-XD-Portal-19-172.20.8.234-Remote-Desktop-Connection-Manager-v2.7.png)
【番外篇 – http 自動轉 https】
◎選擇目的站台,點選「錯誤網頁」。
![](https://it-help.tips/wp/wp-content/uploads/2020/03/2020-03-03-15_15_19-XD-Portal-19-172.20.8.234-Remote-Desktop-Connection-Manager-v2.7.png)
◎在空白處按右鍵,或是在右邊動作欄位選擇「新增」。
![](https://it-help.tips/wp/wp-content/uploads/2020/03/2020-03-03-15_15_56-XD-Portal-19-172.20.8.234-Remote-Desktop-Connection-Manager-v2.7-1.png)
◎在「狀態碼」輸入 “403.4”。
◎選擇「回應 302 重新導向」。
◎在「絕對 URL」輸入含 https 的網址,再按下「確定」即可
![](https://it-help.tips/wp/wp-content/uploads/2020/03/2020-03-03-15_16_36-XD-Portal-19-172.20.8.234-Remote-Desktop-Connection-Manager-v2.7.png)
【參考連結】
- 網路中文: SSL憑證教學文件
- Free SSL Certificates and Free SSL Tools @ ZeroSSL – Zero cost SSL
- IIS HTTP 強制轉 HTTPS 簡易做法-黑暗執行緒