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

Re: Virtual Hosting and the FHS

On Wed, Jul 11, 2001 at 01:20:16PM +0200, Russell Coker wrote:
> Why not use vhost_alias_module in Apache and something like the
> following:  VirtualDocumentRoot /home/www/%-1/%-2/%-3/%-4+

because that's not as flexible as my system. it's fine if you want
all your vhosts exactly the same, but it doesn't allow for individual

also because my virtual-hosts.conf file is a central configuration file
for everything to do with virtual hosts, not just apache - generating
apache config fragments, htdig configuration, nightly log processing,
weekly linbot runs, etc etc.

any script i need to write can just open the virtual-hosts.conf file
and parse it (it's a single line, colon-delimited format) to find out
everything it needs to know about every virtual host.

if i need a new feature, i can easily add it just by writing a new
script. and both new & pre-existing vhosts can have it just by editing
their line in the config file. e.g. adding an htdig option for all
vhosts took me about 2 hours total to write the scripts...now any
vhost with the "htdig" flag in the config file has htdig configuration
generated when make is run.

it also makes it easy for me to track down problems from the vague
reports passed on by customer service - even if they only give me part
of the information, i can easily grep that config file and get all the
details on a single line.

> Then for the logging you can have the following at the start of the
> Apache config:
> LogFormat "%V %h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\" %T"
> Which allows you to produce a single log file with coherant
> information on all domains.  My logtools package has everything you
> need to split up and manipulate the log file generated.  I can supply
> some sample scripts (I'll put them in the next version of logtools) to
> automatically create webalizer stats for all domains dynamically.

i'll look into that.

i need to split up the log files so that each virtual domain can
download their raw access logs at any time. having separate error log
files is necessary for debugging scripts too (and preserving privacy -
don't want user A having access to user B's error logs).

the only trouble is that means at least 2 log files open per vhost per
apache process...on one of my machines, that means 344 log files open
per process, * 50 processes (average) = 17,200 log files open.

that obviously is not very scalable.

i have figured out how to have just one log file open per httpd - a
named pipe to a splitter script, which writes to the real log files.

your logtools may be faster than my perl script. i may hack it to fit
into my scheme of having logs under ~user/www_logs/

i don't know yet what to about error logs. the only thing i can think
of is to hack apache so that every line output to STDERR is prefixed by
"domain:" - then it can be split just like the access logs.

it's either that or give up on the idea of separate error logs....which
makes them basically useless.


craig sanders <cas@taz.net.au>

Fabricati Diem, PVNC.
 -- motto of the Ankh-Morpork City Watch

Reply to: