I've got a server where, included in the service, customers receive their very own personalised subdomain, i.e. username.servicename.com. It isn't particularly achievable to create personalised vhost records each time this occurs, and so i used a wildcard virtualhost file in Apache. This is effective.

I am now looking to get SSL focusing on it. I've got a wildcard SSL certificate having a CommonName of *.servicename.com, and so i think I am doing things i ought to be doing. But... does not work. HTTP demands still work fine, HTTPS demands break, and there is nothing within the logs. What's wrong with my config?

    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>