I don’t mean to sound like I’m just harping at the friendly giant that runs most of the web sites on the net, but I have some issues.
First, Apache 2 has some interesting issues with deadlocking when getting sent a restart signal. I can kill my apache so it just hangs all new connections about 7/10 of the time when I run apachectl graceful
.
Apache 1 just isn’t as featureful as Apache 2, so backporting my configuration would be painful.
The configuration file is amazingly complicated for some simple things. For example, I have Instiki running on my system, so I use mod_rewrite
to direct things from virtualhosts to the instiki service port. The problem comes from lack of templates and the incompleteness of mod_rewrite
. It’s not really fair to pin this on the rewrite module, as a real solution requires smarts at all levels and adherence to standards. However, assume in the following that everything is XHTML strict and follows the HTTP spec exactly. I honestly don’t care about supporting older stuff.
<VirtualHost *:80>
ServerName wiki.foo.org
ServerAlias wiki.bar.org
ServerAlias public.baz.org
RewriteEngine on
RewriteCond %{HTTP_HOST} ([^.]*).([^.]*).(com|net|org)
RewriteRule ^/(.*)$ http://instiki.internal:2500/%2/$1 [P]
</VirtualHost>
That’s not too unweildy, but imagine it with more complex sets of rewrites (I average 20 per vhost in this project, and I have five slightly-varying vhosts), and more names per vhost (I have over a hundred domains per vhost, since I am somewhat successful in reducing the number of vhosts needed by using clever (and hard to read) rewrites.
First problem: having to bind to *:80
, or use an IP in there; I’d like a separate bind statement, like Bind 1.2.3.4:80
and Bind [ffec::1]:80
. Really. Let’s get the bindings out of a hundred (yes, really, I use Apache 2’s ability to include directoryfuls of config files heavily) separate files and many hundred vhosts, and into one place so they’re easy to change.
So the vhosts might look like just <VirtualHost>
. Now, why should the first instance of the names to associate with the vhost be ServerName
and the rest ServerAlias
? In fact, in Apache 2, it’s not neccesary, so just use ServerAlias
always, and let’s abolish ServerName
. Now, let’s add a new directive. TemplateName
, taking a string argument. It’ll define an “abstract” virtual host (possibly in addition to making concrete instances for each ServerAlias
.
Now, to instantiate one of those templates, let’s use another directive, UseTemplate
. It would take a string argument as well, and would copy in any inheritable directives from the vhost where the template was defined.
One other problem here is with mod_rewrite
. It’s impossible to define the equivalent of ProxyPassReverse
using the proxy support in mod_rewrite
. With instiki, that means that it leaks the private internal address to the public whenever a redirect happens. It makes my ruleset double-complicated.