DG Computers
09-17-2003, 01:01 PM
I have a server I am installing blankol on http://www.blankol.com I need to setup wildcard DNS for a domain. How do I do this, I have searched the forum and have seen different posts but none of them clearly explain how to setup wild card DNS.
Thanks,
qm8309
09-17-2003, 01:10 PM
a wildcard is nothing different from a *
and basically thats about it.
in ur zone file, just add a *.domain.com. record.
for example, if u want an A wildcard record on FOO.COM to the IP address 1.1.1.1. then
*.foo.com. IN A 1.1.1.1
DG Computers
09-17-2003, 01:28 PM
Thanks! One more question though....the blankol guy said the following:
1) Wildcard DNS needs to be set up for "domain.com", both in the Nameserver record and in Apache (this appears to have been done already).
2) In Apache, the Virtual Server directive should be such that
"www.domain.com" and "domain.com" both should point to the main website directory
3) In Apache, the Virtual Server directive should be such that "ANYTHINGELSE.domain.com" (*.domain.com) should point to the directory /portal (not the URL /portal, but the documentroot for *.domain.com should be yourmaindirrmainpath/portal)
When set up, www.domain.com and domain.com will pull up the main index.html page in your main website directory.
ANYTHINGELSE.domain.com (blahblah.domain.com,
apples.domain.com, jump.domain.com, etc) will all resolve to the /portal directory.
However, I do not know how to do the above. Any suggestions and steps to take?
Thanks again!
qm8309
09-17-2003, 03:28 PM
name server and apache have different functions. name server is simply responsible for resolving the domain name to an IP address which is wut we have already done by adding the *.domain.com. entry in the zone file.
next is the apache part.
open ur httpd.conf. scroll to the bottom where it lists the virtual hosts. a typical virtual host entry looks like this: (we still use foo.com and 1.1.1.1 as examples). please not that urs mite have much more settings but the ones shown below are essential parts.
<VirtualHost 1.1.1.1>
DocumentRoot "/home/foo"
ServerName foo.com
ServerAlias www.foo.com
</VirtualHost>
this basically tells apache to route all the incoming requests for foo.com and www.foo.com to the directory /home/foo which is foo.com's document root. (http://foo.com/abc.htm will look for abc.htm in this directory)
now since we already set up a wildcard dns for foo.com which means ANYTHINGELSE.foo.com will also be resolved to 1.1.1.1 but we need to let apache route these requests to a proper directory. in this case "the blankol guy" wants these requests to be routed to a different document root /portal. to do this simply add a virtual host entry in httpd.conf AFTER the main virtual host entry (as shown above) for foo.com.
<VirtualHost 1.1.1.1>
DocumentRoot "/home/foo/portal"
ServerName *.foo.com
</VirtualHost>
please note that u may also need other directives to customize the settings for this domain such as log settings, cgi settings etc but we r talking about the basics here.
save httpd.conf and restart apache. now when an incoming request for foo.com or www.foo.com is received by apache, it will be routed to /home/foo. ANYTHINGELSE.foo.com (apple.foo.com, idiot.foo.com etc) will be routed to /home/foo/portal.
please note that it is important to add the wildcard virtual host entry AFTER the main virtual host (foo.com and www.foo.com) becuz apache reads these settings in the order they appear in httpd.conf. so if *.foo.com is added above foo.com/www.foo.com all the requests will be routed to /home/foo/portal.
hope this helps.
Sembiance
09-17-2003, 03:46 PM
Verisign has already taken care of this for you
qm8309
09-17-2003, 03:50 PM
sembiance:
verisign's wildcard is *.com/net which is on an upper level. it has nothing to do with *.foo.com. please do not mislead the thread starter.
DG Computers
09-17-2003, 06:27 PM
Thanks...just to make sure....is this what I will type?
This was already in there:
<VirtualHost 1.1.1.1>
ServerAdmin webmaster@foo.com
DocumentRoot /home/foo/public_html
BytesLog domlogs/foo.com-bytes_log
ServerName www.foo.com
User foo
Group foo
ServerAlias foo.com www.foo.com
CustomLog domlogs/foo.com combined
ScriptAlias /cgi-bin/ /home/foo/public_html/cgi-bin/
</VirtualHost>
NameVirtualHost 1.1.1.1:80
-----
Will I type
<VirtualHost 1.1.1.1>
DocumentRoot /home/foo/public_html/portal
ServerName *.foo.com
</VirtualHost>
before it says NameVirtualHost 1.1.1.1:80?
or right after it?
I will then exit and save changes.....then I will just type httpd restart and it should work. correct?
Thanks again...and I appreciate you helping out someone that is wanting to learn! We are getting a server admin to look at this....but I need this done ASAP and he is not available at this time.
qm8309
09-18-2003, 12:08 AM
cut
NameVirtualHost 1.1.1.1:80
and paste it b4 the first virtual host. (foo.com)
add the wildcard entry after the first virtualhost.(foo.com)
so it should be:
NameVirtualHost 1.1.1.1:80
<VirtualHost 1.1.1.1>
ServerAdmin webmaster@foo.com
DocumentRoot /home/foo/public_html
BytesLog domlogs/foo.com-bytes_log
ServerName www.foo.com
User foo
Group foo
ServerAlias foo.com www.foo.com
CustomLog domlogs/foo.com combined
ScriptAlias /cgi-bin/ /home/foo/public_html/cgi-bin/
</VirtualHost>
<VirtualHost 1.1.1.1>
DocumentRoot /home/foo/public_html/portal
ServerName *.foo.com
</VirtualHost>
like i said in my previous post u mite also need some additional entries for certain settings such as
ScriptAlias /cgi-bin/ /home/foo/public_html/portal/cgi-bin/
if u need to use cgi with the wildcard.