Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm pulling my hard on this configuration, which probably is simply. I have a wildcard ssl certificate which is working. I have the website setup to run on domain.com under SSL.

Now, I'm in need to run many subdomains (*.domain.com) on the same server with the same SSL certificate. Shouldn't be that hard, right? Well, I can't get it going.

Point is, that the first config is another Tomcat server that serves another site and listens to domain.com and www.domain.com. The other config listens to *.domain.com and pulls the content from another Tomcat server.

I already tried this whole setup with mod_rewrite, but simply don't see what I'm doing wrong. Any help very much appreciated.

Here is my conf in Apache 2.2:

<VirtualHost *:443>
        SSLEngine on
        SSLCertificateFile ...
        SSLCertificateKeyFile ...
        SSLCertificateChainFile ...
        ServerName domain.com
        ServerAlias www.domain.com

        ProxyRequests Off
        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>

        ProxyPreserveHost On
        ProxyPass / ajp://localhost:8010/
        ProxyPassReverse / ajp://localhost:8010/

</VirtualHost>

<VirtualHost *:443>
        SSLEngine on
        SSLCertificateFile ...
        SSLCertificateKeyFile ...
        SSLCertificateChainFile ...
        ServerName domain.com
        ServerAlias *.domain.com

        ProxyRequests Off
        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>

        ProxyPreserveHost On
        ProxyPass / ajp://localhost:8009/
        ProxyPassReverse / ajp://localhost:8009/

</VirtualHost>

Thanks.

share|improve this question
    
What exactly is going wrong? Are you getting a browser certificate check error? If so, post the details of that message. It usually shows why the check failed. (eg: Cert for foo.domain.com, actual domain: bar.domain.com) –  Christopher Karel Sep 21 '10 at 13:37
    
I somehow did not get an notify eMail to your reply... –  Nitai Sep 24 '10 at 14:30
    
What is going wrong is that the SSL cert is working fine, but I can either have *.domain.com working and not www.domain.com (which points to another server) or vice-versa. –  Nitai Sep 24 '10 at 14:31
    
In the meantime, I could get it to work 90%, that means that I can forward https requests to the wildcard domain (*.domain.com) but since it is under another documentroot, images, css, etc. don't really work. This is how I could it get to work RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\.com$ [NC] RewriteCond %1 !^(www)$ [NC] RewriteRule ^.*$ ajp://localhost:8009/$1 [P,L] –  Nitai Sep 24 '10 at 14:35

1 Answer 1

Fixed it. Was an issue that my Apache 2.2 did not have VirtualHostName *:443 set. Apache did only set this for port 80.

For Ubuntu users this is in the ports.conf file!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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