本地子域和子子域上的 SSL

本地子域和子子域上的 SSL

我拥有这两者local.domain.com,并lmarket.local.domain.com从 etc/hosts 指向我的本地主机。

问题是我在 Windows 7 上使用 XAMPP,并且我的 apache 配置中有 2 个 SSL VirtualHosts,但无论我访问哪一个,我都会被带到local.domain.com。在非 HTTPS 请求上一切正常,并且 vhosts 基本相同。

这是我的虚拟主机的相关部分:

<VirtualHost local.domain.com:443>
    DocumentRoot "C:/xampp/htdocs/local"
    ServerName local.domain.com
    ServerAdmin webmaster@localhost
    ErrorLog "logs/error.log"
    <IfModule log_config_module>
        CustomLog "logs/access.log" combined
    </IfModule>
    SSLEngine on
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLCertificateFile "conf/ssl.crt/server.crt"
    SSLCertificateKeyFile "conf/ssl.key/server.key"
    <FilesMatch "\.(cgi|shtml|pl|asp|php)$">
        SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory "C:/xampp/cgi-bin">
        SSLOptions +StdEnvVars
    </Directory>
    BrowserMatch ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
    CustomLog "logs/ssl_request.log" "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>

<VirtualHost lmarket.local.domain.com:443>
    DocumentRoot "C:/xampp/htdocs/lmarket.local"
    ServerName lmarket.local.domain.com
    ServerAdmin webmaster@localhost
    ErrorLog "logs/error.log"
    <IfModule log_config_module>
        CustomLog "logs/access.log" combined
    </IfModule>
    SSLEngine on
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLCertificateFile "conf/ssl.crt/server.crt"
    SSLCertificateKeyFile "conf/ssl.key/server.key"
    <FilesMatch "\.(cgi|shtml|pl|asp|php)$">
        SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory "C:/xampp/cgi-bin">
        SSLOptions +StdEnvVars
    </Directory>
    BrowserMatch ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
    CustomLog "logs/ssl_request.log" "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>

如果我反转这些块,则会发生相反的情况:local.domain.com转到lmarket.local.domain.com。任何帮助都将不胜感激。

答案1

你可能忘了告诉 apache 127.0.0.1:443 将用于基于名称的虚拟主机

NameVirtualHost 127.0.0.1:443

甚至更好

NameVirtualHost *:443

应在部分之前添加到您的配置中VirtualHost。您还必须使用VirtualHost您输入的地址更新NameVirtualHost。例如<VirtualHost *:443>

答案2

嗯,我找到了答案......不确定为什么会这样,但我不得不改变:

<VirtualHost lmarket.local.domain.com:443>

<VirtualHost *:443>

第二个虚拟主机也一样。希望这对某些人有帮助。

相关内容