简体   繁体   English

Apache-多个SSL问题

[英]Apache - Multiple SSL Issue

I have 2 sites defined in a file called virtualhosts.conf, loaded at the end of httpd.conf. 我在名为virtualhosts.conf的文件中定义了2个站点,该文件加载在httpd.conf的末尾。

They both have the format of: 它们都具有以下格式:

<VirtualHost IP:80>
  DocumentRoot D:/Site/A/
  ...
</VirtualHost>

<VirtualHost IP:443>
  DocumentRoot D:/Site/A/
  ...
</VirtualHost>

<VirtualHost IP__2:80>
  DocumentRoot D:/Site/B/
  ...
</VirtualHost>

<VirtualHost IP__2:443>
  DocumentRoot D:/Site/B/
  ...
</VirtualHost>

If I load https://sitea.com , with the above config, it loads just fine. 如果我使用上述配置加载https://sitea.com ,则加载就很好。 If I load https://siteb.com with the above config though, it breaks, saying that siteb is identifying itself as sitea. 如果我使用上述配置加载https://siteb.com ,它就会中断,并表示siteb将自己标识为sitea。 If I flip the order of the entries: 如果我翻转条目的顺序:

<VirtualHost IP__2:80>
  DocumentRoot D:/Site/B/
  ...
</VirtualHost>

<VirtualHost IP__2:443>
  DocumentRoot D:/Site/B/
  ...
</VirtualHost>

<VirtualHost IP:80>
  DocumentRoot D:/Site/A/
  ...
</VirtualHost>

<VirtualHost IP:443>
  DocumentRoot D:/Site/A/
  ...
</VirtualHost>

Now, siteb loads just fine, but sitea throws an error that it is identifying itself as siteb. 现在,siteb可以正常加载,但是sitea抛出一个错误,表明自己将自己标识为siteb。

What is going on? 到底是怎么回事? It seems like Apache is defaulting to the 'top' entry in the file, even though both seem to be valid, for their domains, if they are first. 似乎Apache缺省为文件中的“ top”条目,即使这两个域对于它们的域来说似乎都是有效的(如果它们是第一个)。

EDIT: The top of my httpd.conf: 编辑:我的httpd.conf的顶部:

Listen 80
Listen 443

NameVirtualHost IP.50:80
NameVirtualHost IP.50:443

NameVirtualHost IP.51:80
NameVirtualHost IP.51:443

NameVirtualHost IP.52:80
NameVirtualHost IP.52:443

NameVirtualHost IP.53:80
NameVirtualHost IP.53:443

NameVirtualHost IP.54:80
NameVirtualHost IP.54:443

NameVirtualHost IP.55:80
NameVirtualHost IP.55:443

NameVirtualHost IP.56:80
NameVirtualHost IP.56:443

SSL is established ahead of HTTP request and the server doesn't know whose certificate to present when it receives the request. SSL是在HTTP请求之前建立的,并且服务器在收到请求时不知道要提供谁的证书。 This problem doesn't have general solution other than have a dedicated IP for each secure domain. 除了为每个安全域提供专用IP之外,此问题没有通用解决方案。 And BTW your question is off-topic on StackOverflow. 顺便说一句,您的问题在StackOverflow上是题外话。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM