[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Apache Virtual Server

On Mon, 2009-04-27 at 20:42 +0200, Uwe Kiewel wrote:
> I'm not sure how apache recognizes which virtual server the client
> requests. Maybe you need a real dns setup.

The hostname request is sent in the connection from the browser, the
webserver uses the first virtual host that matches the name.  So the
order that you specify hosts in is important if there's any double
matches.  The default will be used if none of the virtual hosts match.

I have virtual hosts configured as per your sample, plus a default one
like this:

<VirtualHost _default_:80>
  DocumentRoot    /var/www/html

That just shows the usual Fedora + Apache, the webserver is working,
test page.

I found it easier to specify *all* websites as virtual hosts, with just
a blank dummy site in the default host (/var/www/html/).  And to avoid
someone being able to cross between sites inappropriately, none of them
are sub-directories inside /var/www/html/.  They all have separate

e.g. Default:  /var/www/html/
     example:  /var/www/example
     test:     /var/www/test

If you don't do that, and you don't want people to be able to access one
site through another, you need complex access limitation rules.

You need to have name and numerical IP address resolution agreeing with
each other on the server and any clients that connect.  That can be done
with their hosts files, or using a DNS server.  For anything more than
about two or three computers, it's easier to use one central DNS server.
Never again will you have to mess with any hosts file for any other
network or server configurations.  And, for some things, the hosts file
is inadequate.

[tim localhost ~]$ uname -r

Don't send private replies to my address, the mailbox is ignored.  I
read messages from the public lists.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]