您的位置:首页 > 其它

转载 同一IP配置多个SSL虚拟主机

2008-08-12 20:36 453 查看
配置一个站点的时候,因为有两个域名,而且都需要支持https,很习惯的按照配置寻常虚拟主机的办法,来设置多个virtualhost,然后在不同的virtualhost里面指定不同的证书配置文件 结果在测试的时候发现,只有默认的第一个站点的证书生效,第二个站点总是用第一个站点的证书,困惑中。 后来网上搜了一下,原来SSL不能用基于域名方式的方法来支持多个SSL只能用多个IP或者多个端口。 参考下面的文章,来自apache的官方文档。 http://httpd.apache.org/docs/2.0/ssl/ssl_faq.html

Why is it not possible to use Name-Based Virtual Hosting to identify different SSL virtual hosts?

Name-Based Virtual Hosting is a very popular method of identifying different virtual hosts. It allows you to use the same IP address and the same port number for many different sites. When people move on to SSL, it seems natural to assume that the same method can be used to have lots of different SSL virtual hosts on the same server.It comes as rather a shock to learn that it is impossible.The reason is that the SSL protocol is a separate layer which encapsulates the HTTP protocol. So the SSL session is a separate transaction, that takes place before the HTTP session has begun. The server receives an SSL request on IP address X and port Y (usually 443). Since the SSL request does not contain any Host: field, the server has no way to decide which SSL virtual host to use. Usually, it will just use the first one it finds, which matches the port and IP address specified.You can, of course, use Name-Based Virtual Hosting to identify many non-SSL virtual hosts (all on port 80, for example) and then have a single SSL virtual host (on port 443). But if you do this, you must make sure to put the non-SSL port number on the NameVirtualHost directive, e.g.
NameVirtualHost 192.168.1.1:80
Other workaround solutions include: Using separate IP addresses for different SSL hosts. Using different port numbers for different SSL hosts. 又baidu了一下,发现其实多域名的SSL证书是有解的。摘录一段如下:==============================[align=left]多域名SSL证书与通配型证书是不同的,通配型SSL证书支持 *.domain.com,即支持同一域名下的所有子域,而多域名证书则是任何域名,不仅限于子域,因为一般一个单位有多个域名和一台虚拟主机上有多个不同的用户的域名,如:domain.com、domain.cn、domain.com.cn、domain.net、domain.net.cn、mydomain.com、domain.us等等。
多域名SSL证书的推出,对于有独立主机的企事业单位来讲,可以让本单位所拥有的所有域名都能部署SSL证书,这样就不会出现以往为domain.com申请了SSL但用户输入https://www.domaimn.com就提示安全警告的问题;也不需要申请多个SSL证书了,如WoTrust为 mail.wotone.com 和 www.wotrust.com 分别申请SSL证书;更加方便的是,再也不用在访问时指定不同的SSL端口了(如:https://mail.wotone.com:481/)。[/align][align=left] 多域名SSL证书的推出,对于虚拟主机服务提供商来讲,就可以拓展业务销售SSL证书给现有的虚拟主机用户了。 以前由于一台主机只有一个443端口,也就是只能有一个虚拟主机用户可以正常使用SSL,而其他用户则只能使用用户不喜欢的加不同的端口号了。但有了多域名SSL证书,虚拟主机服务提供商可以把需要部署SSL证书的用户集中到一台服务器上,最多可以为100个用户(域名)提供SSL部署,使得所有虚拟主机用户都可以直接使用https://www.domain.com了。这不仅大大方便了用户,也为虚拟主机服务提供商提供了新的增值服务收入来源。[/align][align=left]===================================[/align]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: