In the example "*.myserver.net" is a mass hosting
server. So, what does that mean exactly. It will match any host-names
ending with
".myserver.net". The whole string before that can be used to create
additional path information to find the target file of the request.
This
path-part is split further down at every '.' found in it and these
single words are then used to form the path addition recursivly. A few
examples:
| www.myserver.net |
-> |
basepath/www/ |
| www.mycontent.myserver.net |
-> |
basepath/mycontent/www/ |
| pics.mycontent.myserver.net |
-> |
basepath/mycontent/pics/ |
| aa.bb.cc.dd.myserver.net |
-> |
basepath/dd/cc/bb/aa/ |
| october.2005.myserver.net |
-> |
basepath/2005/october/ |
It is possible to define normal hosts and mass hosts which overlap with
already existing ones, basically making it possible to create ones with
different settings:
| *.myserver.net |
mass_a |
| *.archive.myserver.net |
mass_b |
| *.pictures.myserver.net |
mass_c |
| my.server.myserver.net |
mine |
An incoming request host-name
is
first compared directly with the registerd hosts. If no match is found,
the host-name is compared from the first '.', then from the second and
so on. It will stop if the next would have less tha 2 '.' in it
(".myserver.net" would be last). If no match was found at all, the
default server definition will be used.
Mass-host configuration blocks may contain the following additional
commands, which are not inherited if already defined in the default
host:
- no path-create
This is a flag and takes no value. Will disable the path creation based
on the host-name
- mass_root
Path to the root folder for the static content. This is only a path
specification, it doesn't grant access rights to the content there. The
path can be indirect, based on the working directory of the server, or
an absolute path starting with a "/".
- max_mass_level
Defines the maximum additional directory depth taken from the host
name, if exceeded a 403 will be triggered. Accepted values range from
1(default) to a max of 10.
- allow_for_level_X
(with X being the hostname-path-level from 1 to 10)
Default if not defined for
a level, is to allow all. Value is a string containing a space
seperated list of words allowed in the specified level. Those words my
start or end with a '*', meaning that the content before/after can be
any combination of chars. A "hello" is the exact match. A "*ello" would
be all ending with "ello", like ello/jello/hello/mortello. A "hel*"
would be all starting with "hel" like hel/hell/hello/helvetica. A
"*ell*" is currently not supported. You can also use the '?' wildcard
at varying numbers. It may also only be either at the start or the end
of the keyword. Every '?' can be replaced by every char, including a
not existent one, but the total number can not exceed the total amount
of '?'s. So "hel??" might be hel/hell/hello but not helium/helvetica. A
"?ello" could be ello/hello/jello but not shello/mortello. Things like
"?ell?","?","??","???"(....) are currently not supported.
While it might be inherited, it is used slightly different:
- content_root
Additional path information used after mass_root and path-create. This
must not be an absolute path.
How the path is created:
We have a couple of different parts added together to form the complete
path. This gives a relative powerful path-rewrite option which is also
very fast.
| server_root |
// |
Those 2 actually form together an absolute
basepath |
| mass_root |
| hostname |
// |
limited by max_mass_level
and by allow_for_level_X
|
| content_root |
// |
must be indirect, critical error at startup if not |
| request_path |
// |
limited by allowed directory list |
path = /basepath /hostname_parts /content_root /request_path
/filename
At startup the server_root and
the
mass_root are used to determin the absolute basepath. If the mass_root
is an absolute path, the server_root will be discarded.
If the mass_root is indirect it will form a direct one with the
server_root. During a request the given host-name is examined and
contained path parts are added
to the already existing basepath. In the next step the content_root is
added, then the path actually found in the request before the
file name is added in the end.
Example
to use a mass host setup for users:
[Server]
.... (other configurations)
[-Virtual-Servers]
....(other virtual servers)
*.of.myserver.com mass_a
*.pics.myserver.com mass_b
all.pics.myserver.com no_mass
[mass_a-Configuration]
mass_root="/home";
content_root="webcontent";
mainpage="index.html";
max_mass_level=1;
allow_for_level_1="oliver mike annette peter *iffy mis* cow??";
[-Directories]
*
pics
[mass_b-Configuration]
mass_root="/home";
content_root="pictures";
expires=86400;
mainpage="";
max_mass_level=2;
allow_for_level_1="oliver mike annette peter *iffy mis* cow??";
[-Directories]
*
[no_mass-Configuration]
expires=86400;
content_root="/home/pictures"
[-Directories]
*
Request
|
matches with
|
file retrieved
|
| mike.of.myserver.com/ |
mass_a
|
/home/mike/webcontent/index.html |
| mike.of.myserver.com/pics/mypic.gif |
mass_a
|
/home/mike/webcontent/pics/mypic.gif |
| mike.of.myserver.com/html/hallo.html |
mass_a |
403 error because path "html" is not allowed |
buffy.of.myserver.com/
|
mass_a
|
403 error because "buffy"
is not allowed
|
| of.myserver.com/ |
NONE
|
uses default server entry
|
| pics.myserver.com/ |
NONE
|
uses default server entry |
| iffy.of.myserver.com/ |
mass_a
|
/home/iffy/webcontent/index.html |
spiffy.of.myserver.com/
|
mass_a
|
/home/spiffy/webcontent/index.html
|
| misty.of.myserver.com/ |
mass_a
|
/home/misty/webcontent/index.html |
| www.mike.of.myserver.com/ |
mass_a |
403 error because level is 2 |
| cows.of.myserver.com/ |
mass_a
|
/home/cows/webcontent/index.html
|
| coward.of.myserver.com/ |
mass_a
|
403 as coward might start
with cow, but is too long
|
| mike.pics.myserver.com/apic.jpg |
mass_b |
/home/mike/pictures/apic.jpg |
| mike.pics.myserver.com/set2/apic.jpg |
mass_b
|
403 error as "set2" is not
allowed
|
| www.mister.pics.myserver.com/apic.jpg |
mass_b
|
/home/mister/www/pictures/apic.jpg |
| all.pics.myserver.com/apic.jpg |
no_mass
|
/home/pictures/apic.jpg
|
| mike.pics.myserver.com/ |
mass_b |
404 error as no mainpage is defined |
BACK
|