I am able to serve http://www.domain.com and http://domain.com. Also https://domain.com works fine too. But not https://www.domain.com for some reason this doesn't work. I even created a www.domain.com in my sites-availible folder and also enabled it. I reloaded the configuration and yet it still doesn't work.
I have a wildcard certificate so that is NOT the problem.
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin admin@domain.com
ServerName *.domain.com:443
ServerAlias www.domain.com
VirtualDocumentRoot /var/www/%0
Thanks for any help.
Best Answer
To have the same site listening on both HTTP and HTTPS you will need 2 virtual hosts, one for SSL and one for normal connections.
Remove :443 from your "ServerName" parameter.
I just created a config doing what you request here, in my test environment, and this is what I have in my working configuration file:
Also, you have a ServerAlias for www.domain.com - this is not necessary, as the wildcard *.domain.com will catch this.