[Apache] SSL環境を構築する方法

Apache + SSL 環境を構築したので手順をメモ。

ほぼ下記の記事を読めばOKです。

[Think IT] 第7回:Apache+SSL環境を構築しよう! (1/3)

以下、手順です。
 

ApacheのSSL設定

まず、SSL用の設定ファイル httpd-ssl.conf を読み込むようにコメントアウトを外します。

# vi /usr/local/apache2/conf/httpd.conf
Include conf/extra/httpd-ssl.conf

次に、httpd-ssl.conf を編集します。

# vi /usr/local/apache2/conf/extra/httpd-ssl.conf

VirtualHost にグローバルIP、DocumentRoot、ServerName、ServerAdmin を適宜、変更します。

また、SSLCertificateFile と SSLCertificateKeyFile の箇所をそれぞれ証明書のパス、秘密鍵のパスに変更します。

<VirtualHost xxx.xxx.xxx.xxx:443>
DocumentRoot "/usr/local/apache2/htdocs"
ServerName example.com:443
ServerAdmin [email protected]
 
SSLCertificateFile "/usr/local/apache2/conf/server.crt"
SSLCertificateKeyFile "/usr/local/apache2/conf/server.key"

最後に、変更が完了したら、Apacheを再起動します。

# service httpd configtest
# service httpd restart

以上です。