Web Hosting Talk







View Full Version : Question for other hosts...


Webdude
12-29-2000, 08:48 PM
We recently got into name based hosting versus IP based. Partly because it is now supported in Apache and the fact that the experts are saying that IP#'s are running close to a shortage (??couldnt they just add another digit, kinda like the phone comps add another area code??)

Anyway, I have noticed one downside of this....how the heck do you wildcard a name based domain? Nothing I do seems to work..

energy
12-29-2000, 08:52 PM
and you run a web host?
first you set your dns to forward *.yourdomain.com to an ip address
second, you add this line in the virtual host section of yourdomain.com
ServerAlias *.yourdomain.com
restart
done

Webdude
12-29-2000, 09:06 PM
Originally posted by energy
and you run a web host?
first you set your dns to forward *.yourdomain.com to an ip address
second, you add this line in the virtual host section of yourdomain.com
ServerAlias *.yourdomain.com
restart
done

As I said above, name based domains do not use IP's. Any dip knows (well should know) how to wildcard when your using IP numbers...but, how do you wildcard without them? I have tried *.domain.tld in the vhost sections and it doesnt work.

energy
12-29-2000, 09:12 PM
o yes, all machines on the internet use IPs as far as I know.
Name based virtual hosting allow you to have many domains on one ip using NameVirtualHost.
read what I wrote and give it a try

Webdude
12-29-2000, 09:18 PM
The virtual host section is where the problem is. Ok, heres an example of a basic virtual host. The main IP is NameVirtualHost 216.71.44.44

Maybe I just keep changing them wrong, or changing too much, too little...not sure. Whats the proper config for the part below for it to be wildcarded? It works fine when each domain has it's own ip...but this danged named based...

<virtualhost www.foo.com>
ScriptAlias /cgi-bin/plusmail /www/cgi-bin/.cgi-bin/plusmail
ScriptAlias /cgi-bin/ /www/foo/cgi-bin/
ScriptAlias /cgi-foo/ /www/foo/cgi-bin/
User domain
Group domaingrp
ServerAdmin webmaster@foo.com
ServerName foo.com
ServerAlias foo.com
ErrorDocument 404 /missing.html
DocumentRoot /www/foo
ErrorLog logs/foo-error-log
TransferLog logs/foo-access-log
</virtualhost>




[Edited by Webdude on 12-29-2000 at 08:22 PM]

energy
12-29-2000, 09:22 PM
this is how i would do it
<virtualhost foo.com>
ScriptAlias /cgi-bin/plusmail /www/cgi-bin/.cgi-bin/plusmail
ScriptAlias /cgi-bin/ /www/foo/cgi-bin/
ScriptAlias /cgi-foo/ /www/foo/cgi-bin/
User domain
Group domaingrp
ServerAdmin webmaster@foo.com
ServerName foo.com
ServerAlias *.foo.com
ErrorDocument 404 /missing.html
DocumentRoot /www/foo
ErrorLog logs/foo-error-log
TransferLog logs/foo-access-log
</virtualhost>

Webdude
12-29-2000, 09:53 PM
Nope, that disnt work.

<virtualhost foo.com>

I can set this to foo.com, www.foo.com, or the IP. None make a difference.

ServerName foo.com
I have tried several here including both at once (ie: foo.com *.foo.com

ServerAlias *.foo.com
Same here..I have tried several here including both at once (ie: foo.com *.foo.com)

</virtualhost>

I have tried everything at once...one at a time, etc. It simply cant be this friggin difficult...

energy
12-29-2000, 10:00 PM
"I can set this to foo.com, http://www.foo.com, or the IP. None make a difference. "
o yes it does, if you set it to the ip, it becomes an IP based virtual host, not a name based one.

"I have tried several here including both at once (ie: foo.com *.foo.com"

just keep it as ServerName foo.com

ServerAlias *.foo.com
it must be this.
this will cause anything.foo.com to go to foo.com
if it does not work, then the problem is one of the following:
1) you did not restart apache
2) your dns settings are messed up


the server alias is the most important part, i know it works, I'm doing it everyday.

Brian Farkas
12-30-2000, 12:04 AM
You might also want to try this...
Go into the domain name's ZONE FILE, and enter:
* IN CNAME domain.com.
(remember the trailing period)

Also, you'll need to change the serial number on the zone file so that the name servers know it's updated, and you would also need to restart the nameserver. Good luck, I hope this helps.

Brian