Web Servers on Unix and Linux - Apache 1.3 vhost default entries...

This is Interesting: Free IT Magazines  
Home > Archive > Web Servers on Unix and Linux > February 2005 > Apache 1.3 vhost default entries...





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Apache 1.3 vhost default entries...
jtelep

2005-01-20, 5:51 pm

Hi,

I've just set up my first virtual host entries on my web server and
they are working great but I have noticed a rather annoying problem
that I hope someone can shed some light on. I see that my web server
will respond to any host for my domain (existing or not) and I know
that your first vhost entry is your default entry (i.e. any time a host
is requested that isn't in the virtual host list this is the location
that the page is served from). I know that there are some directives
in Apache though for setting up the server to respond differently for
each of these errors (something like the "asis" directive and using
"ErrorDocument" based on the different errors that could come about
(403, 404, 502, etc.) I'm just trying to figure out how to set this
up. I have looked for how-to's on this but can't find anything and it
looks like the information needed to perform this is scattered about
(not in any one place). Can someone direct me on how to set this up
(or at least point me in the direction that might have this info more
easily accessible and available?

Thanks!

John Murtari

2005-01-20, 5:51 pm

"jtelep" <jtelep@telepkids.com> writes:

> Hi,
>
> I've just set up my first virtual host entries on my web server and
> they are working great but I have noticed a rather annoying problem
> that I hope someone can shed some light on. I see that my web server
> will respond to any host for my domain (existing or not) and I know
> that your first vhost entry is your default entry (i.e. any time a host
> is requested that isn't in the virtual host list this is the location
> that the page is served from). I know that there are some directives
> in Apache though for setting up the server to respond differently for
> each of these errors (something like the "asis" directive and using
> "ErrorDocument" based on the different errors that could come about
> (403, 404, 502, etc.) I'm just trying to figure out how to set this
> up. I have looked for how-to's on this but can't find anything and it
> looks like the information needed to perform this is scattered about
> (not in any one place). Can someone direct me on how to set this up
> (or at least point me in the direction that might have this info more
> easily accessible and available?
>
> Thanks!
>


You may want to explain whether you are using IP based
virtual host or name based (sounds like you are using IP). When
apache starts it does a reverse lookup on the names and generates
addresses for each. A request coming into that address gets serviced
by that vhost block. You say you are seeing default (base) pages
come up for hosts that don't exist?, i.e. bongo.mydomain.com

If that is getting though you must have some DNS information
loaded for that, maybe a default wild card in you db record. Just
get rid of that (and define the hosts you truly want), and that
should take care of it.

Hope this helps.

--
John
________________________________________
___________________________
John Murtari Software Workshop Inc.
jmurtari@following domain 315.635-1968(x-211) "TheBook.Com" (TM)
http://thebook.com/
jtelep

2005-01-20, 5:51 pm

You're right, I'm sorry. I'm using name-based virtual hosts (only one
IP address) and, from what I understand, any host entry that's not
found in the virtual host block gets the default (first) vhost entry
(i.e. www.somedomain.com).

David Efflandt

2005-01-20, 8:47 pm

On 20 Jan 2005 09:45:51 -0800, jtelep <jtelep@telepkids.com> wrote:
> You're right, I'm sorry. I'm using name-based virtual hosts (only one
> IP address) and, from what I understand, any host entry that's not
> found in the virtual host block gets the default (first) vhost entry
> (i.e. www.somedomain.com).


I have a dynamic IP (using no-ip.com dynamic DNS) and specifically want
any access that does not specify one of my set name vhosts to go to my
default dead end vhost (which logs those worms separate from other logs).
So for my main ServerName (outside of any vhosts) is specifically set to a
bogus name that does not resolve, and default vhost has no ServerName.
That is because I found that things did not work quite right if main
ServerName matched one of the vhosts. So any Host header that does not
match one of my set vhosts falls into my default worm trap.

I use wildcard NameVirtualHost * along with UseCanonicalName off in
main part of config file, and wildcard <VirtualHost *> for all vhosts. All
vhosts other than default have ServerName or ServerAlias that applies to
that vhost.
Andy Davidson

2005-02-08, 5:49 pm

[jtelep wrote in comp.infosystems.www.servers.unix]
> I've just set up my first virtual host entries on my web server and
> they are working great but I have noticed a rather annoying problem
> that I hope someone can shed some light on. I see that my web server
> will respond to any host for my domain (existing or not) and I know
> that your first vhost entry is your default entry (i.e. any time a host
> is requested that isn't in the virtual host list this is the location
> that the page is served from).


[...snip 'how do I stop this' request]

When I want something similar to happen (I want fotoserve.net and .co.uk
to both point to the main site, but always want the uri to have the
fotoserve.*com* domain in it for cookie purposes), I create a different
'first' virual host, which defines the behaviour of what to do when
none of the other virtual hosts pick up the requests.

So the first <VirtualHost> entry is a catch-all which bounces people to
another site on the box (using a 301, although you could setup a few
pages to produce a 'no such site here' message or similar.)

Hope this helps.


--
http://fotoserve.com/ - Prints, Slides, Posters, Mugs, T-shirts,,
Calendars, Jigsaws, Tableware, Caricatures, Greetings cards, Picture
bags, Photo Album and Book covers, Canvas Prints, tissues and more
..... from your own digital images.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com