量産メモ帳

忘れっぽいのでメモを残しています。浅く適当に書きます。

Apache HTTP Server で SSL を使用できるようにする。

スポンサーリンク

参考にしたページ:



前提条件:

  • OpenSSL 付きの Apache HTTP Server をインストール済み。
  • Apache HTTP Server のインストール先ディレクトリ:

C:\Apache Software Foundation\Apache2.2



修正対象ファイルと修正内容:

  • httpd.conf」ファイル:*1

LoadModule ssl_module modules/mod_ssl.so
Include conf/extra/httpd-ssl.conf

SSLCertificateFile "C:/Apache Software Foundation/Apache2.2/conf/server.crt"
SSLCertificateKeyFile "C:/Apache Software Foundation/Apache2.2/conf/server.key"



最後に所定の場所に秘密鍵と公開鍵とデジタル証明書を作成すれば完了。
以下、自分がコマンドプロンプトで実行したコマンドの入力例:

cd "C:\Apache Software Foundation\Apache2.2"

@REM 秘密鍵を生成。
.\bin\openssl genrsa -des3 1024 > .\conf\server.key

@REM CSRファイル(公開鍵や組織の名前や所在地を示す情報を含む)を作成。
.\bin\openssl req -config .\conf\openssl.cnf -new -key .\conf\server.key > .\conf\server.csr

@REM デジタル証明書を作成。
.\bin\openssl x509 -in .\conf\server.csr -days 365 -req -signkey .\conf\server.key > .\conf\server.crt

@REM 秘密鍵を退避。
copy /-Y .\conf\server.key .\conf\server.key.bak

@REM 秘密鍵パスフレーズを解除。
.\bin\openssl rsa -in .\conf\server.key.bak > .\conf\server.key


*1:C:\Apache Software Foundation\Apache2.2\conf にある。

*2:C:\Apache Software Foundation\Apache2.2\conf\extra にある。