以下の例およびディレクティブを使用して、
httpd.conf ファイルに SSL 仮想ホスト・スタンザを作成します。
LoadModule ibm_ssl_module modules/mod_ibm_ssl.so
<IfModule mod_ibm_ssl.c>
Listen 443
<VirtualHost *:443>
SSLEnable
</VirtualHost>
</IfModule>SSLDisable
KeyFile "c:/Program Files/IBM HTTP Server/key.kdb"
重要: Listen ディレクティブで、
かならずそのポートとともにアドレスを指定します。例えば、デフォルトのアドレス 0.0.0.0 を使用して IPv4 ポート 443 で listen するには、httpd.conf に
Listen 0.0.0.0:443 という Listen ディレクティブを追加します。
この 2 番目の例では、単一の Web サイトが SSL を使用できるように構成されていること、および、サーバー名が、非 SSL (ポート 80) に関してグローバル・スコープで定義されているサーバー名と異なっていることを想定しています。両方のホスト名は、別々の IP アドレスで
ドメイン・ネーム・サーバー (DNS) に登録されていなければなりません。また、ローカル・ネットワーク・インターフェース・カードに両方の IP アドレスを構成する必要があります。
Listen 80
ServerName www.mycompany.com
<Directory "c:/Program Files/IBM HTTP Server/htdocs">
Options Indexes
AllowOverride None
order allow,deny
allow from all
<Directory>
DocumentRoot "c:/program files/ibm http server/htdocs"
DirectoryIndex index.html
<VirtualHost 192.168.1.103:80>
ServerName www.mycompany2.com
<Directory "c:/Program Files/IBM HTTP Server/htdocs2">
Options Indexes
AllowOverride None
order allow,deny
allow from all
</Directory>
DocumentRoot "c:/program files/ibm http server/htdocs2"
DirectoryIndex index2.html
</VirtualHost>
Listen 443
<VirtualHost 192.168.1.103:443>
ServerName www.mycompany2.com
SSLEnable
SSLClientAuth None
<Directory "c:/Program Files/IBM HTTP Server/htdocs2">
Options Indexes
AllowOverride None
order allow,deny
allow from all
</Directory>
DocumentRoot "c:/program files/ibm http server/htdocs2"
DirectoryIndex index2.html
</VirtualHost>
SSLDisable
KeyFile "c:/program files/ibm http server/key.kdb"
SSLV2Timeout 100
SSLV3Timeout 1000
この 3 番目の例では、SSL を使用できるよう複数の Web サイトを構成していることを想定しています。
すべてのホスト名は別々の IP アドレスでドメイン・ネーム・サーバー (DNS) に
登録されていなければなりません。
また、IP アドレスのすべてをローカル・ネットワーク・インターフェース・カードに構成する必要があります。
SSLServerCert ディレクティブを使用して、
Web サイトごとの SSL ハンドシェーク中に鍵データベース・ファイルの
どの個人用サーバー証明書がクライアント・ブラウザーに渡されたかを確認します。
SSLServerCert ディレクティブを定義していない場合、IBM HTTP Server は、「デフォルト鍵」としてマーク (*) されている、鍵データベース・ファイル内の証明書を渡します。
Listen 80
ServerName www.mycompany.com
<Directory "c:/Program Files/IBM HTTP Server/htdocs">
Options Indexes
AllowOverride None
order allow,deny
allow from all
</Directory>
DocumentRoot "c:/program files/ibm http server/htdocs"
DirectoryIndex index.html
<VirtualHost 192.168.1.103:80>
ServerName www.mycompany2.com
<Directory "c:/Program Files/IBM HTTP Server/htdocs2">
Options Indexes
AllowOverride None
order allow,deny
allow from all
</Directory>
DocumentRoot "c:/program files/ibm http server/htdocs2"
DirectoryIndex index2.html
</VirtualHost>
<VirtualHost 192.168.1.104:80>
ServerName www.mycompany3.com
<Directory "c:/Program Files/IBM HTTP Server/htdocs3">
Options Indexes
AllowOverride None
order allow,deny
allow from all
</Directory>
DocumentRoot "c:/program files/ibm http server/htdocs3"
DirectoryIndex index3.html
</VirtualHost>
Listen 443
<VirtualHost 192.168.1.102:443>
ServerName www.mycompany.com
SSLEnable
SSLClientAuth None
SSLServerCert mycompany
<Directory "c:/Program Files/IBM HTTP Server/htdocs">
Options Indexes
AllowOverride None
order allow,deny
allow from all
</Directory>
DocumentRoot "c:/program files/ibm http server/htdocs"
DirectoryIndex index.html
</VirtualHost>
<VirtualHost 192.168.1.103:443>
ServerName www.mycompany2.com
SSLEnable
SSLClientAuth None
SSLServerCert mycompany2
<Directory "c:/Program Files/IBM HTTP Server/htdocs2">
Options Indexes
AllowOverride None
order allow,deny
allow from all
</Directory>
DocumentRoot "c:/program files/ibm http server/htdocs2"
DirectoryIndex index2.html
</VirtualHost>
<VirtualHost 192.168.1.104:443>
ServerName www.mycompany3.com
SSLEnable
SSLClientAuth None
SSLServerCert mycompany3
<Directory "c:/Program Files/IBM HTTP Server/htdocs3">
Options Indexes
AllowOverride None
order allow,deny
allow from all
</Directory>
DocumentRoot "c:/program files/ibm http server/htdocs3"
DirectoryIndex index3.html
</VirtualHost>
SSLDisable
KeyFile "c:/program files/ibm http server/key.kdb"
SSLV2Timeout 100
SSLV3Timeout 1000