Forum Moderators: phranque

Message Too Old, No Replies

wildcard ssl & subdomains

         

webwired

4:00 pm on Jul 25, 2008 (gmt 0)

10+ Year Member



I was wondering if anyone could help me with getting subdomains to work with wildcard ssl.

I am using WHM/cPanel (WHM 11.23.2 cPanel 11.23.4-S26138)

I got a wildcard ssl certificate that allows for an unlimited amount of subdomains, when I attempted to install it via the domain cPanel, it wouldn't accept the "*" so I had to install it through WHM, it took. But it would seem that it took the "*" character as a literal subdomain instead of a wildcard.

What I'm trying to accomplish is this, I have a script that when a user signs up for a trial account, it automatically creates a subdomain and copies the contents from one location to that subdomain as well as other things like create a database and tables. I need the wildcard ssl certificate to cover any of those domains created, so each of them can use it.

I attempted a few things, like to put a manual entry in the httpd.conf for one of the subdomains for the secure side, that didn't work, it gave me an internal server error 500 when I went to view it...


NameVirtualHost 204.13.***.168:443
<IfDefine SSL>
<VirtualHost 204.13.***.168:443>
ServerName imauser.example.com
ServerAlias www.imauser.example.com
DocumentRoot /home/example/public_html/imauser
ServerAdmin webmaster@*.example.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/*.example.com-bytes_log
ScriptAlias /cgi-bin/ /home/example/public_html/imauser/cgi-bin/
SSLEngine on
SSLCertificateFile /usr/share/ssl/certs/*.example.com.crt
SSLCertificateKeyFile /usr/share/ssl/private/*.example.com.key
SSLCACertificateFile /usr/share/ssl/certs/*.example.com.cabundle
SSLLogFile /usr/local/apache/domlogs/*.example.com-ssl_data_log
CustomLog /usr/local/apache/domlogs/*.example.com-ssl_log combined
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
</VirtualHost>
</IfDefine>

So I tried to modify the entry it had in there for the wildcard ssl subdomains, bit it didn't do anything at all...


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

[edited by: jdMorgan at 1:12 pm (utc) on July 30, 2008]
[edit reason] Obscured specifics [/edit]

webwired

5:08 pm on Jul 25, 2008 (gmt 0)

10+ Year Member



Ok, I got this, ...


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

The only thing I need it to do now is point to whatever subdomain its supposed to, I tried adding the asterisk at the end, "DocumentRoot /home/example/public_html/*" but that didn't work...

[edited by: jdMorgan at 1:14 pm (utc) on July 30, 2008]
[edit reason] Obscured specifics [/edit]

webwired

7:08 pm on Jul 25, 2008 (gmt 0)

10+ Year Member



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/example/public_html/

To:

VirtualDocumentRoot /home/example/public_html/%1

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

[edited by: jdMorgan at 1:15 pm (utc) on July 30, 2008]
[edit reason] Obscured specifics [/edit]

webwired

8:07 pm on Jul 25, 2008 (gmt 0)

10+ Year Member



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...

jdMorgan

1:59 pm on Jul 27, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry you haven't gotten any help here... It sounds like that module wasn't compiled-in with your Apache build. If you installed Apache as a "pre-built package," you might want to look up whatever build you're using, and see if that module was considered optional -- and if so, how to rebuild with it included.

Jim

webwired

2:10 pm on Jul 27, 2008 (gmt 0)

10+ Year Member



Thank you jdMorgan, you're the first person in 4 forums to respond... LOL... 2 of which are paid forums...

My server has cPanel, so it installed apache in its own way, I just need to figure out how to install mod_vhost_alias.so

Its source file, whatever that means, is located at "/home/cpeasyapache/src/apache_1.3.41/src/modules/standard/mod_vhost_alias.c"

webwired

4:36 pm on Jul 27, 2008 (gmt 0)

10+ Year Member



I got it... finally...