【问题标题】:ssl wildcard sub domain www.sub.domain.comssl 通配符子域 www.sub.domain.com
【发布时间】:2016-10-21 19:46:30
【问题描述】:

我为 *.domain.com 购买了通配符 ssl 证书。 我用:

  • 为 ssl 证书启动 ssl 提供程序
  • Apache 虚拟主机

我希望每个请求都被重定向到 HTTPS NO-WWW

我设法做到了:

  • http://sub.domain.com => https://domain.com 没问题
  • http://www.sub.domain.com => https://sub.domain.com 没问题

但是

https://www.sub.domain.com => https://domain.com 不正常 (NET::ERR_CERT_COMMON_NAME_INVALID)

你能帮帮我吗?

<VirtualHost *:80>
 ServerName sub.domain.com
 Redirect permanent / https://sub.domain.com
</VirtualHost>
<VirtualHost *:80>
 ServerName www.sub.domain.com
 Redirect permanent / https://sub.domain.com
</VirtualHost>
Listen 443
<VirtualHost *:443>
 ServerAdmin mail@domain.com
 ServerName sub.domain.com
 ServerAlias www.sub.domain.com
 DocumentRoot  /home/sub.domain.com
 <Directory />
  Options FollowSymLinks
  AllowOverride None
 </Directory>
 <Directory  /home/sub.domain.com>
  Options Indexes FollowSymLinks MultiViews
  AllowOverride All
  Order allow,deny
  allow from all
 </Directory>
 SSLEngine on
 SSLProtocol all -SSLv2 -SSLv3
 SSLCipherSuite ALL:!DH:!EXPORT:!RC4:+HIGH:+MEDIUM:!LOW:!aNULL:!eNULL
 SSLCertificateFile   /etc/ssl/2__.sub.domain.com.crt
 SSLCertificateKeyFile  /root/sub.domain.com.key
 SSLCertificateChainFile    /etc/ssl/1_root_bundle.crt 
</VirtualHost>

【问题讨论】:

    标签: ssl https subdomain wildcard virtualhost


    【解决方案1】:

    *.domain.com(第一域子域)的通配符证书对 www.sub.domain.com(第二级子域)无效。您需要 *.sub.domain.com 的通配符证书。

    SSL Multilevel Subdomain Wildcard

    【讨论】:

    • 哇,越来越贵了……谢谢!那么在同一台服务器上可以有多个通配符证书吗?
    【解决方案2】:

    详细讨论通配符SSL证书

    通配符 SSL 的主要功能是保护网站及其无限数量的子域。

    但有一些限制,您只能保护一级通配符域

    例如,如果您的通配符 SSL 证书适用于 *.domain-name.com,则您可以将 Lelve-1 子域保护为

    • blog.domain-name.com
    • login.domain-name.com
    • anything.domain-name.com

    现在,如果您希望保护特定子域的子域怎么办? - 这是你的情况。

    这里,*.domain-name.com 的通配符 SSL 将不起作用。最终的解决方案是,您需要为该特定子域提供通配符 SSL 证书。这称为二级子域安全。

    因此,如果您希望保护 blog.domain-name.com 的二级子域,您需要为 *.blog.domian-name.com 购买通配符 SSL 证书。现在您可以将以下类型的子域保护为..

    • user1.blog.domain-name.com
    • user2.blog.domain-name.com
    • user3.blog.domain-name.com
    • user4.blog.domain-name.com

    【讨论】:

      【解决方案3】:

      您可能误解了通配符 SSL 功能。让我在下面详细说明,通配符 SSL 证书适用于星号 (*)。您可以使用任何子域来代替星号。

      示例1:如果你已经签发了SSL证书*.domain.com,它会安全,

      https://domain.com
      https://www.domain.com
      https://mail.domain.com
      https://video.domain.com
      https://anything.domain.com
      

      但它不会保护二级子域。

      示例 2: 现在,如果您在 *.sub.domain.com 上颁发了证书,它将是安全的,

      https://sub.domain.com
      https://mail.sub.domain.com
      https://photo.sub.domain.com
      https://anything.sub.domain.com
      

      在 *.sub.domain.com 上发布的通配符 SSL 不会保护示例 1 中的任何 URL。

      现在,如果您想保护上述所有 URL(示例 1 + 2),那么您应该使用 多域通配符证书。它将为您提供使用单一证书保护多级子域的便利。

      【讨论】:

        猜你喜欢
        • 2012-08-20
        • 2018-05-11
        • 2014-09-10
        • 2012-08-09
        • 2014-05-10
        • 2014-04-01
        • 1970-01-01
        相关资源
        最近更新 更多