具有自动子域转发的通配符SSL证书

时间:2012-01-21 18:12:19

标签: apache ssl

我有一台服务器,作为服务的一部分,用户可以获得自己的个性化子域名,即username.servicename.com。每次发生这种情况时生成个性化的vhost条目并不是特别可行,因此我在Apache中使用了通配符虚拟主机文件。这非常有效。

我现在正试图让SSL工作。我有一个Commonname为* .servicename.com的通配符SSL证书,所以我认为我正在做我应该做的事情。但是......不起作用。 HTTP请求仍然正常,HTTPS请求超时,日志中没有任何内容。我的配置有什么问题?

    NameVirtualHost *:80
    NameVirtualHost *:443
    DirectoryIndex index.htm index.html index.php

    <VirtualHost *:80>

        ServerName servicename.com
        ServerAlias *.servicename.com #wildcard catch all
        VirtualDocumentRoot /var/www/%1
        UseCanonicalName Off
        IndexOptions FancyIndexing
        ### Use mod_rewrite to direct servicename.com to www.
        RewriteEngine On
        RewriteCond %{HTTP_HOST} ^servicename.com
        RewriteRule (.*) http://www.%{HTTP_HOST}$1 [R=301,L]
        ### Logging
        LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
        CustomLog /var/log/apache2/access_log_servicename combined

        <Directory /var/www>
            Options FollowSymLinks Indexes MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

    </VirtualHost>

    <VirtualHost *:443>

        ServerName servicename.com
        ServerAlias *.servicename.com
        VirtualDocumentRoot /var/www/%1
        UseCanonicalName Off
        IndexOptions FancyIndexing
        ### Use mod_rewrite to direct servicename.com to www.
        RewriteEngine On
        RewriteCond %{HTTP_HOST} ^servicename.com
        RewriteRule (.*) https://www.%{HTTP_HOST}$1 [R=301,L]
        ### Logging
        LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
        CustomLog /var/log/apache2/access_log_servicename combined

        SSLEngine on
        SSLProtocol all
        SSLCertificateFile /etc/apache2/servicename.com.certificate
        SSLCertificateKeyFile /etc/apache2/servicename.com.key
        SSLCACertificateFile /etc/apache2/rapidssl.intermediateca

        <Directory /var/www>
            Options FollowSymLinks Indexes MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error-ssl.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

    </VirtualHost>

0 个答案:

没有答案