[Nottingham] Re: Web server questions

Graeme Fowler graeme at graemef.net
Sun Apr 10 08:40:39 BST 2005

On Sat, 2005-04-09 at 22:17 +0100, Matt wrote:
> This is called virtual hosting and AFAIK was introduced with HTTP1.1.
> Without this every website would need it's own IP and we'd soon run
> out.

Indeed. Please allow me for a few minutes to put one of my work hats on,
and I'll give you some examples... for those who don't know (many
already do) I'm a development engineer at PIPEX (formerly Host Europe,
and Webfusion before that). Hosting is - part of - our business :)

Webfusion originally got a /19 IP allocation from RIPE [0]

A /19 allocation is 32 * /24s - or Class C netblocks, if you're more
familiar with that notation. That's nominally 32 * 255 = 8160 IP

If we used HTTP/1.0 for everything, and only had a single router and
nothing else we'd only be able to host a total of 8157 sites (that's
a /19 less broadcast, network and router addresses).

As it is, we host hundreds of thousands of sites, and our dedicated
server and colocated customers host hundreds of thousands more between

> One of the headers the browser sends is the "Host" header which
> the server uses to decide which virtual host to use, and each virtual
> host can have it's own DocumentRoot and other settings.
<snip good telnet example>

There are several ways to do that with Apache [1]. The easiest and
probably most widely-used way is to use separate <VirtualHost> sections
in the main config file, or to include a directory with an Include
statement where that directory contains one file per virtual host with
the same info in it.
The problem with that is that if you're hosting more than a few thousand
sites, dependent on server power, the Apache startup and/or reload time
can become a limiting factor. At this point you need to start looking
towards other solutions - and there are quite a number. The links below
for the Apache docs detail a few ways to do this - in a nutshell, if you
have sort of site list with the details in a directory (either
filesystem or database), you can make Apache do what you need it to.

Other webservers are also available ;-)

Most distributions come with Apache either installed by default or as an
additional component depending on your setup. If you want to get your
head around virtual hosts, have a play with it on your home machine -
you'll probably also learn some stuff about name resolution on the way,
which is a good thing to know...

Time for me to take my work hat off, and get on my bike while the
weather's good!


[0] http://www.ripe.net/info/ncc/index.html

[1] http://httpd.apache.org/docs/vhosts/index.html or

More information about the Nottingham mailing list