Dec 24, 2006
19
0
151
cPanel Access Level
Website Owner
Hello,

One of my free webhosting users asked me if I could create a "Wildcard subdomain" for him, as he was wanting to run a short URL script. Could some one please give me a short tutorial on how to create this Wildcard Subdomain, anyhelp would be appreciated. This is what the user posted about this request of his:

REQUIREMENTS:
This software requires a running webserver (preferred apache) with php 4.1 installed (no version below 4.1 is supported!).
You also need 1 or more domains with wildcarded subdomains. If you are not sure what this means, ask you webspace provider about this.
The wildcards must point to the web root directory.
The software has been tested under Windows™ and Redhat™ Linux (both with apache as webserver).

Is it possible to provide me wildcarded subdomain?
Would I need root access of some sort if I were set up these wildcard subdomains?

Thank you, (I hope some one can assist me on this)

-echo_unlimited

Edit: I've used the search feature, but I cannot find a thread which I can undestand, I need this explained in simple terms as I do not understand how to do a wildcard subdomain. :( I don't even know what a wildcard domain is or what it can do. It's very new to me.
 

tweakservers

Well-Known Member
Mar 30, 2006
379
0
166
you will need to have access to the DNS zone file to edit the DNS zone for that domain by adding this:

* IN A ShareDomainIP

Replace ShareDomainIP with the IP that the domain is currently resolving to when you ping domain.com
 
Dec 24, 2006
19
0
151
cPanel Access Level
Website Owner
you will need to have access to the DNS zone file to edit the DNS zone for that domain by adding this:

* IN A ShareDomainIP

Replace ShareDomainIP with the IP that the domain is currently resolving to when you ping domain.com
Thank you. I'll have to wait and see if this script works before I can say what you've said is working for me. But for now I'll post a screen shot and if you could check everything is correct, it would be very much appreciated.

Screen shot:

http://img294.imageshack.us/img294/49/cpanelwhmphio1.png
 

Spiral

BANNED
Jun 24, 2005
2,020
8
193
Trhosting.net gave you the instructions for manually editing the zone files ...

If you are using the DNS editor, then you won't see the word "IN" anywhere.

1. In that last line, you need to change "IN" to "*" ...

2. Restart your DNS server (BIND) ...

3. You need to edit the httpd.conf and add a ServerAlias to the virtual host
that will be handling the wildcard domains as "*.domain.com" where
domain.com is your domain name. If you are not technically inclined
and sounds like you aren't, you could possibly do this by parking a
wildcard (*) domain to that account.

4. Restart your web server

I am surprised you would allow a "free hosting client" to setup a short url redirect
service from your servers (what you said in your first post) because that is probably
going to seriously such the network connections, DNS queries, and possibly a
fair bit of bandwidth --- not something I'd think you would want them to do
unless they are actually paying you for it.

--AMZ
 
Last edited:

Spiral

BANNED
Jun 24, 2005
2,020
8
193
Does anyone think the ability to create wildcard dns should be put forward as a feature request?
Why? It's just a simple matter of adding wildcard to the DNS and HTTPD.CONF!

In fact, you can even have accounts use wilcards automatically already!

Just update the DNS zone templates in WHM and add the wildcard put the required
extra "ServerAlias" in httpd templates (/usr/local/cpanel/etc/httptemplates)
 

Spiral

BANNED
Jun 24, 2005
2,020
8
193
...because its defeats the whole point of a user-friendly cPanel? Hey, lets just do away with WHM altogether since everything can be done via SSH instead!
Apparently you failed to read my last post since the part you didn't quote
tells you exactly how to do it from WHM directly! ;)
 

adept2003

Well-Known Member
Aug 11, 2003
283
0
166
~ "/(extra|special)/data"
Why? It's just a simple matter of adding wildcard to the DNS and HTTPD.CONF!
...because its defeats the whole point of a user-friendly cPanel? Hey, lets just do away with WHM altogether since everything can be done via SSH instead!

Actually, I was really just asking if this might be a useful/common requirement for web hosts, in which case it would be good to have it as an automated feature (especially for the server admin newbies).
 
Last edited:

hbidad

Well-Known Member
Apr 16, 2005
74
1
158
Code:
# nano /usr/local/apache/conf/httpd.conf
add this to the Domain virtual host entry:

Code:
ServerAlias *.domain.com
(replace domain.com with the actual domain)


Then:

Code:
# nano /var/named/domain.com.db
(replace domain.com with the actual domain)

add the following line to the bottom if the file:

Code:
*       14400   IN      A       XXX.XXX.XXX.XXX
Replace XXX.XXX.XXX.XXX with the IP of the domain (e.g. 192.168.0.1)

Then:

Code:
# service named restart
lastly:

Code:
# service httpd restart
Enjoy