I have a server where, as part of the service, users are given their own personalised subdomain, i.e. username.servicename.com. It's not particularly feasible to generate personalised vhost entries every time this happens, so I used a wildcard virtualhost file in Apache. This works great.
I'm now trying to get SSL working on it. I have a wildcard SSL certificate with a CommonName of *.servicename.com, so I think I'm doing what I should be doing. But... doesn't work. HTTP requests still work fine, HTTPS requests time out, and there's nothing in the logs. What is 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>