Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Wildcard SSL Woes

    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:

    Code:
    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

  • #2
    New Coder
    Join Date
    Jul 2011
    Posts
    67
    Thanks
    0
    Thanked 13 Times in 13 Posts
    Hey Pete,

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

  • #3
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Cags View Post
    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:
    Code:
    <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

  • #4
    New Coder
    Join Date
    Jul 2011
    Posts
    67
    Thanks
    0
    Thanked 13 Times in 13 Posts
    It might be worth taking a look at this...

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


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •