Forum Moderators: phranque
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]
<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]
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
DocumentRoot /home/example/public_html/
VirtualDocumentRoot /home/example/public_html/%1
[edited by: jdMorgan at 1:15 pm (utc) on July 30, 2008]
[edit reason] Obscured specifics [/edit]
Jim
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"