...

View Full Version : Wildcard SSL Woes



pete.robinson
08-19-2011, 12:50 PM
Hi Guys,
So I've recently bought and installed a wildcard SSL on my server which governs domain.com and any subdomain that I add to it.

In essence, the cert works fine. For example, if I set up a static 'hello world' PHP page and set the domain to sub1.domain.com, the page is displayed in both HTTP and HTTPS (with some mod_rewrite which I'll come to shortly).

The issue is that the domain is serving applications, which all kind of need their own document root to function properly.

If I print_r the $_SERVER array outside HTTPS, I see the correct document root - something like:
/home/domain.com/public_html/_apps/sub1/
That would be the doc root for sub1.domain.com

If I then switch over to HTTPS and again, print_r the $_SERVER array, I get:
/home/domain.com/public_html

It seems to be completely ignoring the docroot for that subdomain. The current mod_rewrite I'm using in the docroot of the base domain is:


RewriteEngine On
RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{HTTP_HOST} ^sub1\.domain\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/_apps/sub1/
RewriteRule ^(.*) /_apps/sub1/$1

This is required to get the wildcard SSL working across multiple subdomains. Without this, switching to SSL just reverts to the base domain.

Does anybody know if/how I can maintain the document root from normal HTTP inside HTTPS and stop it changing the document root to that of the base domain when running through HTTPS?

Cheers
Pete

Cags
08-19-2011, 09:57 PM
Hey Pete,

What does your VirtualHost setup look like, do you just have the one default Virtual host that is catching all requests?

pete.robinson
08-22-2011, 10:44 AM
Hey Pete,

What does your VirtualHost setup look like, do you just have the one default Virtual host that is catching all requests?

Hi Cags,
My VirtualHost setup looks like this:

<VirtualHost XXX.XXX.XXX.XXX:80>
ServerName sub1.domain.com
ServerAlias www.sub1.domain.com
DocumentRoot /home/domain/public_html/_apps/sub1/public_html
ServerAdmin webmaster@sub1.domain.com
UseCanonicalName On
CustomLog /usr/local/apache/domlogs/sub1.domain.com combined
CustomLog /usr/local/apache/domlogs/sub1.domain.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
## User wunderap # Needed for Cpanel::ApacheConf
<IfModule !mod_disable_suexec.c>
SuexecUserGroup wunderap wunderap
</IfModule>
ScriptAlias /cgi-bin/ /home/domain/public_html/_apps/sub1/public_html/cgi-bin/
</VirtualHost>

No, there is one virtualhost entry for each subdomain.

Thanks
Pete

Cags
08-22-2011, 10:49 AM
It might be worth taking a look at this...

http://wiki.apache.org/httpd/NameBasedSSLVHosts



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum