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.

link|improve this question
feedback

2 Answers

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:

<IfModule mod_ssl.c>   
  <VirtualHost _default_:443>
    ServerAdmin www@srv.fbh

    ServerName *.srv.fbh
    VirtualDocumentRoot /www/%0/ 

    SSLEngine on
    SSLCertificateFile    /etc/ssl/test/server.crt
    SSLCertificateKeyFile /etc/ssl/test/server.key   
  </VirtualHost>
</IfModule>

Also, you have a ServerAlias for www.domain.com - this is not necessary, as the wildcard *.domain.com will catch this.

link|improve this answer
Hmmm, this didn't seem to fix the problem. – mdgreenwald Feb 13 '11 at 18:51
feedback

This:

<IfModule mod_ssl.c>
  <VirtualHost *:443>
    ServerAlias *
    UseCanonicalName Off
    VirtualDocumentRoot /var/www/%0

    SSLEngine on
    SSLCertificateFile      /path-to-keys/ca.crt
    SSLCertificateKeyFile   /path-to-keys/yours.key
    SSLCertificateChainFile /path-to-keys/bundle.crt

    RequestHeader set X_FORWARDED_PROTO 'https'
  </VirtualHost>
</IfModule>

Of course you need the proper files there, and remember to set yours.key to chmod 400. I did notice you got this part working already, just keeping the answer more complete. ;)

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.