httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Richards <p...@netcraft.co.uk>
Subject Re: -d | !-d ? <-
Date Fri, 15 Sep 1995 13:22:53 GMT
In reply to Ben Laurie who said
> 
> Well quite. Then httpd.conf should be in /baz/boo/httpd.conf, which says
> 
> 	ServerRoot /foo/bar
> 
> and then where are we?
> 
> It has always struck me as a mite bizarre to have a directive in a file which
> defines the directory that file should be in. By the time we read the directive
> we already know where the file is.

Deja vu or what. I said almost exactly the same thing to Andy when we
were looking at this last weekend.

I came up with the following scheme (even wrote a parser for it there and
then using lex and yacc).

<Default>
Define here default entries for things like user, group, etc. Which can
be overriden on a per virtual host basis below.
</Default>

<Server>
ServerName	bar.org
ServerRoot /foo/bar
....
host specific details
</Server>

<Server>
ServerName	baz.org
ServerRoot /foo/baz
....
host specific details
</Server>

<Server>
Include  "foo.conf"
</Server

The last option allows you to split virtual host configurations into
separate files if that's what you want to do.

The output from my parser is a linked list of server structs

struct Server {
	struct Server *next;
	Char *servername;
	char *serverroot;
	etc.
}

That all worked rather nicely, but I had no idea how to smash my nice
linked list into the correct structs for Apache to actually work :-)
Something to think about after 1.0, there'd need to be a backwards
compatible parser to read old config files but since the old format is
actually rather broken, since it allows inconsistencies such as the -d thing
then maybe 1.1 should just have a new style of configuration.

It raised a few issues whihc I don't fully understand. e.g. what is
ServerName's function. Andy went through an example of redirects where
it's used so I could see it in action but I'm curious as to whether it's
actually needed. Can't the reverse entry for the ip address that the
server is listening on be used for the ServerName? Are there cases when you
need the server to masquerade under a different name?


-- 
  Paul Richards, Netcraft Ltd.
  Internet: paul@netcraft.co.uk, http://www.netcraft.co.uk
  Phone: 0370 462071 (Mobile), +44 1225 447500 (work)

Mime
View raw message