[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [cobalt-users] [raq4] [DNS] wildcard DNS ?
- Subject: RE: [cobalt-users] [raq4] [DNS] wildcard DNS ?
- From: "Kai" <go@xxxxxxxxxxxx>
- Date: Fri Mar 15 10:18:09 2002
- List-id: Mailing list for users to share thoughts on Cobalt products. <cobalt-users.list.cobalt.com>
Is your aim wildcarded DNS? So that someone may type
anything.yourdomain.com?
Or just one subdomain?
If it's just one subdomain RTFM. ( An explaination is actually at the end of
this email :) )
If it's wildcarded DNS you want, this is what I did. I must add that I did
not read
any instructions, I played around until something worked.. so this may not
be the
most effective way but here goes:
[root@yourbox]$ cd /etc/named
[root@yourbox]$ ls
db.cache pri.somedomain.com
pri.otherdomain.com pri.somemoredomain.com pri.domain.com
pri.0.0.127.in-addr.arpa pri.somedomain.org
pri.moredomains.com pri.domain.net pri.pseudo.com.au
records
Get the picture? This is a list of all your domains. Pick the domain you
want. I'm going to pick pseudo.com.au since it really is my domain.
So:
[root@yourbox]$ pico pri.pseudo.com.au
<you will get a heap of junk here... i've erased it from the email because
we dont need it...but dont erase it from the file on ur server>
; the inclusion will be made.
;
pseudo.com.au. in a 203.31.191.32
hosting.pseudo.com.au. in a 203.31.191.32
kai.pseudo.com.au. in a 203.31.191.32
www.pseudo.com.au. in a 203.31.191.32
Ok. So you have that right? Well... Add this entry:
*.pseudo.com.au. in a 203.31.191.32
So now it will look like this:
*.pseudo.com.au. in a 203.31.191.32
pseudo.com.au. in a 203.31.191.32
hosting.pseudo.com.au. in a 203.31.191.32
kai.pseudo.com.au. in a 203.31.191.32
www.pseudo.com.au. in a 203.31.191.32
Good! Done! Save that and exit. Next step. When we did the "ls" above, there
was a file "records".
So:
[root@yourbox]$ pico records
a - yourdomain.com 203.31.191.32 24
a - somedomain.com 203.31.191.32 24
a - pseudo.com.au 203.31.191.32 24
a - www pseudo.com.au 203.31.191.32 24
a - kai pseudo.com.au 203.31.191.32 24
You get the point. It will have a long list of your domains.
Add this entry to it next to the domain you want to make wildcarded:
a * pseudo.com.au 203.31.191.32 24
So you will have:
[root@yourbox]$ pico records
a - yourdomain.com 203.31.191.32 24
a - somedomain.com 203.31.191.32 24
a - pseudo.com.au 203.31.191.32 24
a - www pseudo.com.au 203.31.191.32 24
a - kai pseudo.com.au 203.31.191.32 24
a * pseudo.com.au 203.31.191.32 24
Save that. Now. To restart named:
[root@yourbox]$ /etc/rc.d/init.d/./named restart
I didn't actually do this. I simply went into the control panel and into the
DNS settings
and clicked "save changes" etc and that did it.
Now... When you type whatever.domain.com it should work however, it will
redirect you back
to www.yourdomain.com. So we need to remove the ReWrite rules that do this:
[root@yourbox]$ pico /etc/httpd/conf/httpd.conf
Now. Hit Control-W to search for your domain. You will see your virtual
site.
<VirtualHost 203.31.191.32>
ServerName www.pseudo.com.ai
ServerAdmin admin
DocumentRoot /home/sites/site8/web
ServerAlias pseudo.com.au
RewriteEngine on
RewriteCond %{HTTP_HOST} !^203.31.191.32(:80)?$
RewriteCond %{HTTP_HOST} !^www.pseudo.com.au(:80)?$
RewriteRule ^/(.*) http://www.pseudo.com.au/$1 [L,R]
RewriteOptions inherit
AliasMatch ^/~([^/]+)(/(.*))? /home/sites/site8/users/$1/web/$3
AddHandler cgi-wrapper .cgi
AddHandler cgi-wrapper .pl
AddHandler server-parsed .shtml
AddType text/html .shtml
AddType application/x-httpd-php .php4
AddType application/x-httpd-php .php
# AddHandler chiliasp .asp
# AddHandler chiliasp .asa
</VirtualHost>
Might not look exactly the same but u get the idea. If it's totally
different then I can't help you.
Anyway. So now. See this bit of the virtual site?:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^203.31.191.32(:80)?$
RewriteCond %{HTTP_HOST} !^www.pseudo.com.au(:80)?$
RewriteRule ^/(.*) http://www.pseudo.com.au/$1 [L,R]
RewriteOptions inherit
This basically says. That if someone types any valid a record into the
browser, to redirect it to
http://www.pseudo.com.au. Except when they type: 203.31.191.32 or
www.pseudo.com.au
All I did to prevent this, was to delete it. Yep. Delete it. This is what
will stop it from redirecting you.
However... Doing this prevents you from being able to type:
http://www.yourdomain.com/siteadmin and it redirecting you to:
https://www.yourdomain.com:81/.cobalt/siteManage/www.yourdomain.com/index.ht
ml
And:
http://www.yourdomain.com/personal and it redirecting you to
https://www.yourdomain.com:81/.cobalt/personal/index.html
So obviously this is a problem. You want to be able to type
www.watever.com/siteadmin
SO!!!.... The workaround? Easy. Take this:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^203.31.191.32(:80)?$
RewriteCond %{HTTP_HOST} !^www.pseudo.com.au(:80)?$
RewriteRule ^/(.*) http://www.pseudo.com.au/$1 [L,R]
RewriteOptions inherit
Remove the "!" before "^203.31...." and "^www.pseudo.com.au" so that it now
looks like:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^203.31.191.32(:80)?$
RewriteCond %{HTTP_HOST} ^www.pseudo.com.au(:80)?$
RewriteRule ^/(.*) http://www.pseudo.com.au/$1 [L,R]
RewriteOptions inherit
Now save. And type:
[root@yourbox]$ /etc/rc.d/init.d/./httpd restart
Sometimes after i restart httpd, my webserver doesnt respond. if this
happens type:
[root@yourbox]$ killall -9 httpd
then [root@yourbox]$ /etc/rc.d/init.d/./httpd restart
Do this at your own risk. A while a go i killed every service on my raq. Had
to reboot it :)
But if you follow this you should be good.
Now... All works. When you type your URL it will come up as what you type.
When you type /siteadmin
or /personal that works.
Now.
Question: Why does changing the rewrite rule work?
Answer: I have no idea!!! It just does. As far as i know. The "!" means not.
So the statement above means
rewrite any URL to http://www.pseudo.com.au EXCEPT where the http_host =
203.31.191.32 ( as per below )
and www.pseudo.com.au ( below also )
RewriteCond %{HTTP_HOST} !^203.31.191.32(:80)?$
RewriteCond %{HTTP_HOST} !^www.pseudo.com.au(:80)?$
Now my logic tells me if i take the "!" away it means rewrite everything
including these. But that does not make sense
So maybe it just goes... "Well... I'll do exactly as you wish master,
regardless of Rewrite syntax" hehe. I really don't know.
So there you have it. It works. Enjoy.
....But wait... There's more. You probably want a directory for your
subdomains right? Done!!!
Just add this before "RewriteOptions inherit"
RewriteCond %{HTTP_HOST} [^.]*\sub.domain.tld$
RewriteRule ^(.*)$
/the/path/to/the/directory/you/want/to/be/the/root/folder/web/$1
And that should work. I normally just create a user off the existing domain
( in this case www.pseudo.com.au ) and
use their personal homepage. IE: if we want a subdomain kai.pseudo.com.au
i'd just create the user "kai" and
its normal webpage is http://www.pseudo.com.au/~kai. use the path
/home/sites/site<number>/users/kai/web/
and presto... Done!
DONE!!!!!
I know nothing about linux, but managed to find this out on my own. Hope you
have fun! BTW: If in doubt.... RTFM!
http://httpd.apache.org/docs/mod/mod_rewrite.html
And by the way... to prove this works:
http://whatever.you.want.pseudo.com.au and siteadmin works too. and the user
kai etc.
all works.
Kind Regards,
Kai.
kai@xxxxxxxxxxxxx
-----Original Message-----
From: cobalt-users-admin@xxxxxxxxxxxxxxx
[mailto:cobalt-users-admin@xxxxxxxxxxxxxxx]On Behalf Of Sean Chester
Sent: Saturday, 16 March 2002 1:03 AM
To: cobalt users
Subject: [cobalt-users] [raq4] [DNS] wildcard DNS ?
hi - would anyone be so kind as to explain how i could setup an a
sub.sub.sub.sub.sub.domain.tld for a www address.
(http://this.is.the.sort.of.thing.i.mean.domain.co.uk)
im sure its pretty straight forward but i dont know what to search
for to find a solution.
--
Sean Chester, sean.chester@xxxxxxxxxxxxxx on 15/03/2002
_______________________________________________
cobalt-users mailing list
cobalt-users@xxxxxxxxxxxxxxx
To Subscribe or Unsubscribe, please go to:
http://list.cobalt.com/mailman/listinfo/cobalt-users