首页 > 解决方案 > WWW domain loading wrong ssl certificate

问题描述

If i try to load https://exampledomain.com it loads correctly and the certificate loaded is from exampledomain.com. If i try to load https://www.exampledomain.com the typical chrome warning certificate shows because it tries to load another certificate that is from another virualhost hosted in the same web server. If i press the continue button, it shows the correct virtualhost web but the certificate warning from the other virtualhost is still showing.

I can't understant why this is happening. Virtualhost seems to be correctly defined because the host is working without the www. It just dont work if I prepend the www. But the website is still correct, the only thing that is wrong is that it tries to load the certificate from another virtualhost.

Anyone has experienced something like this before? Any thoughts? Thank you...

标签: apachesslcentoscertificatevirtualhost

解决方案


为了让 example.com 和www.example.comhttps 一起工作,不仅需要定义适当的虚拟主机,而且证书必须实际匹配主机的名称。即,如果一个人访问www.example.com服务器证书必须实际上是有效的www.example.com,而不仅仅是example.com。在您的设置中似乎并非如此。

基本上有两种正确配置的方法:拥有不同的 VirtualHost 并提供不同的证书,每个证书都匹配 VirtualHost 的特定名称。或者有一个 VirtualHost 部分和一个多域证书,其中包含两个域的主题备用名称。


推荐阅读