_default_ VirtualHost在端口443上重叠,第一个优先

我有两个Ruby on Rails 3应用程序运行在相同的服务器,(Ubuntu 10.04),都与SSL。

这是我的apacheconfiguration文件:

<VirtualHost *:80> ServerName example1.com DocumentRoot /home/me/example1/production/current/public </VirtualHost> <VirtualHost *:443> ServerName example1.com DocumentRoot /home/me/example1/production/current/public SSLEngine on SSLCertificateFile /home/me/example1/production/shared/example1.crt SSLCertificateKeyFile /home/me/example1/production/shared/example1.key SSLCertificateChainFile /home/me/example1/production/shared/gd_bundle.crt SSLProtocol -all +TLSv1 +SSLv3 SSLCipherSuite HIGH:MEDIUM:!aNULL:+SHA1:+MD5:+HIGH:+MEDIUM </VirtualHost> <VirtualHost *:80> ServerName example2.com DocumentRoot /home/me/example2/production/current/public </VirtualHost> <VirtualHost *:443> ServerName example2.com DocumentRoot /home/me/example2/production/current/public SSLEngine on SSLCertificateFile /home/me/example2/production/shared/iwanto.crt SSLCertificateKeyFile /home/me/example2/production/shared/iwanto.key SSLCertificateChainFile /home/me/example2/production/shared/gd_bundle.crt SSLProtocol -all +TLSv1 +SSLv3 SSLCipherSuite HIGH:MEDIUM:!aNULL:+SHA1:+MD5:+HIGH:+MEDIUM </VirtualHost> 

问题是什么:

重新启动我的服务器,它给了我一些这样的输出:

  * Restarting web server apache2 [Sun Jun 17 17:57:49 2012] [warn] _default_ VirtualHost overlap on port 443, the first has precedence ... waiting [Sun Jun 17 17:57:50 2012] [warn] _default_ VirtualHost overlap on port 443, the first has precedence 

在谷歌search为什么这个问题来了,我有这样的事情:

您不能使用基于名称的虚拟主机与SSL,因为SSL握手(当浏览器接受安全Web服务器的证书时)发生在HTTP请求之前,该请求标识了基于虚拟主机的适当名称。 如果您打算使用基于名称的虚拟主机,请记住,它们只能与您的非安全Web服务器一起使用。

但无法弄清楚如何在同一台服务器上运行两个SSL应用程序。

任何人都可以帮助我吗?

差不多了!

添加到ports.conf或http.conf并保持你的上面的configuration。

 <IfModule mod_ssl.c> # If you add NameVirtualHost *:443 here, you will also have to change # the VirtualHost statement in /etc/apache2/sites-available/default-ssl # to <VirtualHost *:443> # Server Name Indication for SSL named virtual hosts is currently not # supported by MSIE on Windows XP. # !important below! NameVirtualHost *:443 Listen 443 </IfModule> 

它帮助我执行“/ usr / sbin / apachectl -S”。 这个命令出口在同一条path上显示两个“ssl.conf”文件。 移动或删除罪犯文件,一切都应该工作。

你可以在/etc/apache2/ports.conf添加这个到你的apacheconfiguration文件中:

 <IfModule mod_ssl.c> Listen 443 <IfModule !mod_authz_core.c> # Apache 2.2 NameVirtualHost *:443 </IfModule> </IfModule> 

(这在两个工作:Apache 2.2和2.4)