Sat Jan 7 23:19:10 CET 2006

Configuring Apache 2

Apache 2's configuration, as laid out in Debian anyway, ends up being quite different from that of Apache 1.3. In a good way, I guess, but it takes a bit of work to get it all working as one may wish.

So, first thing is that VirtualHost directives are no longer in httpd.conf, and in fact httpd.conf doesn't exist any more, replaced with apache2.conf. We now add domains in /etc/apache2/sites-available, then enable them with a2ensite. Great, now I see my page

Next, get SSI (Server-Side Includes) working. That takes the usual Options Includes, then enable the SSI module with a2enmod. Great, now I have the stylesheet and title.

Holy crap, CGI scripts don't get executed, they get swallowed! Now there is shell and Perl code all over the page! A quick look through Apache's very fine manual gets me to uncomment the AddHandler cgi-script .cgi in apache2.conf. Great, the page all works fine!

Next in line, how do I get the VirtualHosting to work? I add a new file in /etc/apache2/sites-available, enable it with a2ensite, to no avail: I get a pretty

[Sat Jan 07 23:26:56 2006] [warn] NameVirtualHost *:0 has no VirtualHosts
This seems harmless, and is due to Debian's host file all containing NameVirtualHost * at their beginning. Really this should be in apache2.conf.

So, I tried to be too smart: using wildcard characters to create a virtual host like

ServerName *.rutschle.net
doesn't work. Oh well.

-----