顯示具有 Apache 標籤的文章。 顯示所有文章
顯示具有 Apache 標籤的文章。 顯示所有文章

2016年10月20日 星期四

在全新的 Apache 2.4 設定 HTTPS

在完成跟 GoDaddy 申請憑證之後,Godaddy 網站上可以取得兩個 CRT 檔
我這邊拿到的,一個是命名很像亂碼的 fe461f1ba212ab7.crt 檔案,另一個則是 gd_bundle-g2-g1.crt。
fe461f1ba212ab7.crt 這個檔案是 SSL Certificate File,而 gd_bundle-g2-g1.crt 則是 SSL Certificate Chain File
加上申請憑證前,我們需要自行先產生的金鑰,假設檔名是 my-private-key.key
總共有三個檔案,就可以完成 Apache 2.4 的 HTTPS 設定了。

2016年8月24日 星期三

Apache 2 SSL 的 Passphrase 問題

在 Apache 2 裡,如果要使用有被 Passphrase 保護的 key 給 SSL 使用
必須在某處提供 SSL 的 Passphrase 才能讓 Apache 正常啟動。

一般內建的方法是使用 builtin,也就是 Apache 啟動時會直接詢問使用者
其他方法則是可以把 Passphrase 寫在某個檔案裡,要 Apache 啟動時去讀取。

而寫設定的地方,在我的 container 中是放在 /etc/apache2/mods-enabled/ssl.conf 裡。

如果是不想那麼麻煩地處理 Passphrase 問題,想把他從金鑰中移掉
則可以參考 [2] 的方法,只需要指定輸入和輸出的金鑰檔名,然後輸入 Passphrase
就可以重製出一個不需要 Passphrase 的金鑰了。

以 RSA 的金鑰來說,指令如下:

openssl rsa -in /path/to/your/rsakey.key -out /path/to/your/rsa.nocrypt.key

參考資料
  1. Apache Requires SSL / Passphrase
  2. Remove the passphrase from an existing OpenSSL key file