Jump to content

subdomains and secure subdomains pointing to two different places


webent

Recommended Posts

Hi, I was wondering if someone could help me out with a bit of trouble I'm having... I'm using: (WHM 11.23.2 cPanel 11.23.4-S26138)

 

I installed a wildcard ssl certificate for use with domain webzcart, (*.webzcart.com), so that all subdomains of that domain could use a shared ssl environment... Cpanel would not let me install it, but WebHost Manager did allow me to as long as I changed the user to "nobody"

 

Now when I test it out though, http://imauser.webzcart.com continues to point to the right location, but https://imauser.webzcart.com points to somewhere completely different, I'm not exactly sure where, its just a cPanel/Apache page...

 

Anyone have any ideas?

Link to comment
Share on other sites

From researching I've found that the problem most likely lies in the httpd.conf file, so I've looked through it and sure enough found a very peculiar entry that would seem to be causing me my grief... it is as follows...

 

<VirtualHost 204.13.168.168:443>
    ServerName *.webzcart.com
    ServerAlias www.*.webzcart.com
    DocumentRoot /usr/local/apache/htdocs
    ServerAdmin webmaster@*.webzcart.com
    UseCanonicalName off
    UserDir public_html
    <IfModule mod_suphp.c>
        suPHP_UserGroup nobody nobody
    </IfModule>
    BytesLog /usr/local/apache/domlogs/*.webzcart.com-bytes_log
    ScriptAlias /cgi-bin/ /usr/local/apache/htdocs/cgi-bin/
    SSLEngine on
    SSLCertificateFile /usr/share/ssl/certs/*.webzcart.com.crt
    SSLCertificateKeyFile /usr/share/ssl/private/*.webzcart.com.key
    SSLCACertificateFile /usr/share/ssl/certs/*.webzcart.com.cabundle
    SSLLogFile /usr/local/apache/domlogs/*.webzcart.com-ssl_data_log
    CustomLog /usr/local/apache/domlogs/*.webzcart.com-ssl_log combined
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
</VirtualHost>

 

So I was wondering, before I go goofing around with this seemingly very important file,... would this be the correct alteration to make?

 

DocumentRoot /home/webzcart/public_html/*

Link to comment
Share on other sites

Ok, so I think I've determined that each sub-domain has its own entry, for both secure and unsecure (:80 & :443) ... So I thought to myself, if I add this entry, it might just work, at least for that sub-domain, which would be progress...

 

NameVirtualHost 204.13.168.168:443

<IfDefine SSL>
<VirtualHost 204.13.168.168:443>
    ServerName imauser.webzcart.com
    ServerAlias www.imauser.webzcart.com
    DocumentRoot /home/webzcart/public_html/imauser
    ServerAdmin webmaster@*.webzcart.com
    <IfModule !mod_disable_suexec.c>
        User nobody
        Group nobody
    </IfModule>
    UserDir public_html
    <IfModule mod_suphp.c>
        suPHP_UserGroup nobody nobody
    </IfModule>
    BytesLog /usr/local/apache/domlogs/*.webzcart.com-bytes_log
    ScriptAlias /cgi-bin/ /home/webzcart/public_html/imauser/cgi-bin/
    SSLEngine on
    SSLCertificateFile /usr/share/ssl/certs/*.webzcart.com.crt
    SSLCertificateKeyFile /usr/share/ssl/private/*.webzcart.com.key
    SSLCACertificateFile /usr/share/ssl/certs/*.webzcart.com.cabundle
    SSLLogFile /usr/local/apache/domlogs/*.webzcart.com-ssl_data_log
    CustomLog /usr/local/apache/domlogs/*.webzcart.com-ssl_log combined
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
</VirtualHost>
</IfDefine>

 

Well, that didn't work, got a internal server error 500 for my trouble... which at this time I'm drawing a conclusion that it has something to do with the fact that the "SSLCertificateFile /usr/share/ssl/certs/*.webzcart.com.crt" and other entries are using the wildcard character, which doesn't match the "ServerName imauser.webzcart.com"

 

So, if that's the case, if I'm correct that is, it would seem that you can't use a wildcard ssl certificate with subdomains... But that just doesn't seem right either, because I'm sure that people don't have to buy a separate ssl certificate for each and every subdomain they have, besides, the ssl certificate advertises that it can work for an unlimited amount of subdomains...

 

If anyone has any advice or could point me in the right direction, I'd certainly appreciate it...

Link to comment
Share on other sites

Ok, so I've gotten the secure side to point to a different location, but I'm still not sure on how to make it point to the correct location, depending on what subdomain it is...

 

<VirtualHost 204.13.168.168:443>
    ServerName *.webzcart.com
    ServerAlias www.*.webzcart.com
    DocumentRoot /home/webzcart/public_html/
    ServerAdmin webmaster@*.webzcart.com
    UseCanonicalName off
    UserDir public_html
    <IfModule mod_suphp.c>
        suPHP_UserGroup webzcart webzcart
    </IfModule>
    BytesLog /usr/local/apache/domlogs/*.webzcart.com-bytes_log
    ScriptAlias /cgi-bin/ /home/webzcart/public_html/cgi-bin/
    SSLEngine on
    SSLCertificateFile /usr/share/ssl/certs/*.webzcart.com.crt
    SSLCertificateKeyFile /usr/share/ssl/private/*.webzcart.com.key
    SSLCACertificateFile /usr/share/ssl/certs/*.webzcart.com.cabundle
    SSLLogFile /usr/local/apache/domlogs/*.webzcart.com-ssl_data_log
    CustomLog /usr/local/apache/domlogs/*.webzcart.com-ssl_log combined
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
</VirtualHost>

 

How do I make it point to whatever subdomain it is, I tried putting an asterik at the end, "DocumentRoot /home/webzcart/public_html/*" but that didn't work...

Link to comment
Share on other sites

Found this, the way it was explained, it was exactly what I was looking for...

 

VirtualDocumentRoot was used instead of DocumentRoot. The “%1” at the end of the path tells the server to look at the first part of the URL (in our case the subdomain) and to use that value as the directory to serve that subdomain's web pages and files from.

VirtualDocumentRoot /home/example.com/public_html/%1

 

so I changed it...

From:

DocumentRoot /home/webzcart/public_html/

To:

VirtualDocumentRoot /home/webzcart/public_html/%1

 

But apache wouldn't restart with that... so I'm still in the same spot...

Link to comment
Share on other sites

Ok, so it would seem that I have to put this in the httpd.conf file to make VirtualDocumentRoot work...

 

LoadModule vhost_alias_module ???/mod_vhost_alias.so

 

But I can't seem to find that file on the server... In fact, I did this...

 

find / -name "mod_vhost_alias.so"

 

And it didn't return any results...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.