仅在ssl请求的子域转发到主域

时间:2016-09-13 16:35:02

标签: apache ssl virtualhost httpd.conf

下面是我编辑的ssl.conf的副本,用于删除任何识别信息。

目前,我们有一个外卡SSL证书,以及我们计划使用此证书托管的多个子域。 Apache confirms this should be possible

现在,域名2正在转发到www,但我可以找出原因。为了缩小范围,我完全从文件中删除了www虚拟主机并重新部署。 重定向仍然发生(并且作为唯一的vhost,它加载了domain2文件结构)

我无法弄清楚这种重定向发生的位置。证书可能存在问题吗? (我确认证书上的通用名称是* .example.com)

Listen ip-of-server:443

LoadModule ssl_module   modules/mod_ssl.so

SSLPassPhraseDialog     builtin
AcceptMutex             flock
SSLSessionCache         shmcb:/var/cache/mod_ssl/scache(512000)
SSLSessionCacheTimeout  300
SSLMutex                default
SSLRandomSeed           startup /dev/urandom  256
SSLRandomSeed           connect builtin

NameVirtualHost ip-of-server:443

<VirtualHost ip-of-server:443>
        SSLEngine on
        SSLStrictSNIVHostCheck on

        SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP

SSLCertificateFile /etc/apache/ssl/STAR.example.com.pem
SSLCertificateKeyFile /etc/pki/tls/private/example.com.key

        ServerName      "domain2.example.com"
        DocumentRoot    "/srv/www/domain2.example.com/public_html"

        CustomLog       "/srv/www/domain2.example.com/logs/access.log" combined
        ErrorLog        "/srv/www/domain2.example.com/logs/error.log"

        <Directory /var/www/html>
                AllowOverride none

                Order Allow,Deny
                Allow from all
        </Directory>
</VirtualHost>

<VirtualHost ip-of-server:443>
        SSLEngine on
        SSLStrictSNIVHostCheck on

        SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP

SSLCertificateFile /etc/apache/ssl/STAR.example.com.pem
SSLCertificateKeyFile /etc/pki/tls/private/example.com.key

        ServerName      "www.example.com"
        DocumentRoot    "/srv/www/www.example.com/public_html"

        CustomLog       "/srv/www/www.example.com/logs/access.log" combined
        ErrorLog        "/srv/www/www.example.com/logs/error.log"

        <Directory /var/www/html>
                AllowOverride none

                Order Allow,Deny
                Allow from all
        </Directory>
</VirtualHost>

1 个答案:

答案 0 :(得分:0)

在某些时候我们有一个301重定向指向domain2到www。谷歌浏览器缓存了301.使用devtools打开禁用缓存会导致页面在ssl上正确加载。