在 Windows Server 2012 R2 的 IIS 8.5 上安裝及設定 SSL 憑證
環境:
- Windows Server 2012 R2
- IIS 8.5
前提:
- 安裝 OpenSSL (Windows 平台可從 https://slproweb.com/products/Win32OpenSSL.html 下載後安裝)
- .pem 格式的證書 (.crt 應該也可以,待測試)
- 私鑰 (Private key)
unable to load private key 3332:error:0909006C:PEM routines:......:Expecting: ANY PRIVATE KEY
操作步驟:
1. 將 .pem 證書和 Private key 放在 openssl.exe 所在的路徑 (例如:C:\Program Files\OpenSSL-Win64\bin)
2. 開啟 [命令提示字元],進入上述的路徑,輸入:
openssl pkcs12 -export -out myserver.pfx -inkey <私鑰檔名> -in <.pem 證書檔名>
3. 出現下列訊息後建立 .pfx 檔案的密碼:
4. 輸入密碼兩次後按下 Enter 鍵,即會產生 .pfx 檔案。
5. 打開IIS,選取 IIS 站台首頁。
6. 找到伺服器憑證。
7. 在右邊的動作列點選 [匯入]。
8. 載入製作好的 .pfx 憑證檔案。
9. 輸入證檔的密碼。
10. 點擊 [確定]。
接下來就可以綁定 SSL 網域了
11. 點選 IIS 站台首頁下的網站。
12. 選擇網站後,在右邊動作列找到 [繫結]。
13. 選擇 [新增]。
14. 類型選擇 https。
15. 輸入網址名稱。
16. 選擇 SSL 憑證。
17. 點擊 [確定]。
18. 點擊右邊動作列的 [重新啟動]。
在瀏覽器中輸入 https 開頭的網址,應可以正確開啟網頁。
此篇教學有參考下列網頁的說明:
https://www.sslsupportdesk.com/ssl-installation-instructions-for-windows-iis-8-and-8-5/
https://blog.johnwu.cc/article/iis-install-ssl-certificate.html
http://dog0416.blogspot.com/2017/08/opensslwindows-crt-key-pfx.html
Comments