ブラウザからSSLでアクセスした際に、信頼されてない証書というエラーダイアログが出ても良いので、下記のことを実現したいんですが、可能なのでしょうか?誰か知ってる人がいたら教えて下さい。
WEBサーバはApache 2.2.11です。
やりたいことは、下記のようなssl設定ファイルで、httpsでアクセスするURLによってドキュメントルートを変えたいということです。どちらのURLも同じ証書を使うのでも問題なく、ブラウザに信頼されてない証書というエラーダイアログが出ても問題ないです。
このブログを参考に、
http://d.hatena.ne.jp/simpraight/20070502/1178154663
下記の設定ファイルを使ってみましたが、どちらのURLでアクセスしても同じドキュメントルートのコンテンツが表示されてしまいます。
NameVirtualHost *:443 # <VirtualHost *:443> ServerAdmin admin@[ドメイン名] DocumentRoot /home/www ServerName www.[ドメイン名] ErrorLog logs/www/error_log CustomLog logs/www/access_log combined env=!nolog SSLEngine on SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP SSLCertificateFile /etc/httpd/conf/ssl.crt/[ドメイン名].crt SSLCertificateKeyFile /etc/httpd/conf/ssl.key/[ドメイン名].key <Files ~ "\.(cgi|shtml|phtml|php3?)$"> SSLOptions +StdEnvVars </Files> SetEnvIf User-Agent ".*MSIE.*" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 </VirtualHost> <VirtualHost *:443> ServerAdmin admin@[ドメイン名] DocumentRoot /home/member ServerName member.[ドメイン名] ErrorLog logs/member/error_log CustomLog logs/member/access_log combined env=!nolog SSLEngine on SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP SSLCertificateFile /etc/httpd/conf/ssl.crt/[ドメイン名].crt SSLCertificateKeyFile /etc/httpd/conf/ssl.key/[ドメイン名].key <Files ~ "\.(cgi|shtml|phtml|php3?)$"> SSLOptions +StdEnvVars </Files> SetEnvIf User-Agent ".*MSIE.*" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 </VirtualHost>
追記(2009/3/3)ごめんなさい、出来ました。
上記の方法で問題なかったみたいです。どっか記述ミスしてたっぽい。
最終的なhttpd-ssl.confは下記のようにしました。
Listen 443 AddType application/x-x509-ca-cert .crt AddType application/x-pkcs7-crl .crl SSLPassPhraseDialog builtin SSLSessionCache "shmcb:/usr/local/apache/logs/ssl_scache(512000)" SSLSessionCacheTimeout 300 SSLMutex "file:/usr/local/apache/logs/ssl_mutex" ## ## SSL Virtual Host Context ## NameVirtualHost *:443 <VirtualHost *:443> ServerName www.hoge.com ServerAdmin root@hoge.com ErrorLog "/home/hoge/logs/error_log" TransferLog "/home/hoge/logs/access_log" DocumentRoot /home/hoge/public_html DirectoryIndex index.html index.htm index.shtml index.php index.pl <Directory /home/hoge/public_html> Options All -Indexes AllowOverride All Order deny,allow Allow from all </Directory> # SSL Engine Switch: # Enable/Disable SSL for this virtual host. SSLEngine on SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL SSLCertificateFile "/usr/local/apache/conf/ssl/wwwhogecom.crt" SSLCertificateKeyFile "/usr/local/apache/conf/ssl/wwwhogecom.key" <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory "/usr/local/apache/cgi-bin"> SSLOptions +StdEnvVars </Directory> BrowserMatch ".*MSIE.*" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 CustomLog "/usr/local/apache/logs/ssl_request_log" \ "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" </VirtualHost> <VirtualHost *:443> ServerName www.hoge2.com ServerAdmin root@hoge2.com ErrorLog "/home/hoge2/logs/error_log" TransferLog "/home/hoge2/logs/access_log" DocumentRoot /home/hoge2/public_html DirectoryIndex index.html index.htm index.shtml index.php index.pl <Directory /home/hoge2/public_html> Options All -Indexes AllowOverride All Order deny,allow Allow from all </Directory> ## SSL Engine Switch: ## Enable/Disable SSL for this virtual host. SSLEngine on SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL SSLCertificateFile "/usr/local/apache/conf/ssl/wwwhogecom.crt" SSLCertificateKeyFile "/usr/local/apache/conf/ssl/wwwhogecom.key" <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory "/usr/local/apache/cgi-bin"> SSLOptions +StdEnvVars </Directory> BrowserMatch ".*MSIE.*" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 CustomLog "/usr/local/apache/logs/ssl_request_log" \ "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" </VirtualHost>