我有4个虚拟主机。
我正在使用Zend服务器。 httpd.conf文件似乎包含使用通配符的虚拟主机conf文件,如下所示:
Include "C:\blah\blah2\Zend\ZendServer/etc/sites.d/vhost_*.conf"
我的虚拟主机配置文件如下。现在,对我来说令人费解的是 当我转到https://www-test.blah.com或https://www-test2.blah.com时,它运行正常。但是当我去https://review-test.blah.com时,它会转到www-test.blah.com
这令我感到困惑,因为就我所知,一切看起来都像是以同样的方式设置。
是否可能由于虚拟主机文件是通过通配符包含的,它们的包含顺序是否有问题?如果它是按字母顺序排列的,那么它将包含在显示的顺序中。
我注意到的一件事是,如果我在服务器上,https://review-test.blah.com工作正常。但当我在其他地方我的网络时,它会指引我https://www-test2.blah.com。
或者是否有其他可能会影响Apache选择虚拟主机的方式?例如,证书文件是否重要?
Listen 80
Listen 443
<VirtualHost *:80>
ServerName portal.blah.com:80
</VirtualHost>
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
NameVirtualHost review-test.blah.com:443
<VirtualHost review-test.blah.com:443>
OTHER STUFF HERE
OTHER STUFF HERE
OTHER STUFF HERE
OTHER STUFF HERE
SSLEngine on
SSLCertificateFile "C:\blah\blah\Apache2\conf\extra\ssl\review-test.blah.com.crt"
SSLCertificateKeyFile "C:\blah\blah\Apache2\conf\extra\ssl\review-test.blah.com.key"
ServerName review-test.blah.com
ServerAlias review-test.blah.com
</VirtualHost>
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
NameVirtualHost www-test.blah.com:443
<VirtualHost www-test.blah.com:443>
OTHER STUFF HERE
OTHER STUFF HERE
OTHER STUFF HERE
OTHER STUFF HERE
SSLEngine on
SSLCertificateFile "C:\blah\blah\Apache2\conf\extra\ssl\star.blah.com.crt"
SSLCertificateKeyFile "C:\blah\blah\Apache2\conf\extra\ssl\star.blah.com.key"
ServerName www-test.blah.com
ServerAlias www-test.blah.com
</VirtualHost>
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
NameVirtualHost www-test2.blah.com:443
<VirtualHost www-test2.blah.com:443>
OTHER STUFF HERE
OTHER STUFF HERE
OTHER STUFF HERE
OTHER STUFF HERE
SSLEngine on
SSLCertificateFile "C:\blah\blah\Apache2\conf\extra\ssl\star.blah.com.crt"
SSLCertificateKeyFile "C:\blah\blah\Apache2\conf\extra\ssl\star.blah.com.key"
ServerName www-test2.blah.com
ServerAlias www-test2.blah.com
</VirtualHost>
答案 0 :(得分:0)
我能够解决它。
以下命令有助于了解如何解析虚拟主机。
httpd -S
我的解决方案如下:
Listen 80
Listen 443
<VirtualHost *:80>
ServerName portal.blah.com:80
</VirtualHost>
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
<VirtualHost *:443>
OTHER STUFF HERE
OTHER STUFF HERE
OTHER STUFF HERE
OTHER STUFF HERE
SSLEngine on
SSLCertificateFile "C:\blah\blah\Apache2\conf\extra\ssl\review-test.blah.com.crt"
SSLCertificateKeyFile "C:\blah\blah\Apache2\conf\extra\ssl\review-test.blah.com.key"
ServerName review-test.blah.com
ServerAlias review-test.blah.com
</VirtualHost>
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
NameVirtualHost *:443
<VirtualHost *:443>
OTHER STUFF HERE
OTHER STUFF HERE
OTHER STUFF HERE
OTHER STUFF HERE
SSLEngine on
SSLCertificateFile "C:\blah\blah\Apache2\conf\extra\ssl\star.blah.com.crt"
SSLCertificateKeyFile "C:\blah\blah\Apache2\conf\extra\ssl\star.blah.com.key"
ServerName www-test.blah.com
ServerAlias www-test.blah.com
</VirtualHost>
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
<VirtualHost *:443>
OTHER STUFF HERE
OTHER STUFF HERE
OTHER STUFF HERE
OTHER STUFF HERE
SSLEngine on
SSLCertificateFile "C:\blah\blah\Apache2\conf\extra\ssl\star.blah.com.crt"
SSLCertificateKeyFile "C:\blah\blah\Apache2\conf\extra\ssl\star.blah.com.key"
ServerName www-test2.blah.com
ServerAlias www-test2.blah.com
</VirtualHost>