Apache Application Server

March 15th, 2008

With libapache2-modxslt (or similar) and mod_dbd, Apache gets a heck of a lot closer to an application server. In considering this, I was thinking about how to generate XML documents indirectly and dynamically. That's when I remembered this:

The idea here is to have Apache serve real files so that the cache control can also be dynamically controlled. For example, if a user updates a database record, the previously generated xml documents would need to be regenerated. If they were cached using Apache's mod_cache methods, it might not be as simple to purge a particular group of cached documents.

By having the XML document server (maybe powered by python, php, or something) write and purge the documents to the filesystem upon generation, Apache can then do what it does so well - talk to clients.

So guess what - it works! Here's the test setup I created: /var/www/public/main.xsl/var/www/public/entries.xml/var/www/public/entries.php

RewriteCond %{REQUEST_FILENAME} entries.xml
RewriteCond /var/www/public%{REQUEST_FILENAME}   !-s
RewriteRule .          /xslt/entries.php   [T=application/x-httpd-php,L]
<directory "/var/www/public/xslt">
        Order deny,allow
        Deny from all
        Allow from 192.168
        SetOutputFilter mod-xslt
        AddType text/xml .xml
        XSLTSetStylesheet text/xml /var/www/public/xslt/main.xsl
Follow-up: Webthing has some really cool modules for working with Apache as an application server, like mod_line_edit:

It could be used to manage simple aberrations between different sites, for uses such as tracking codes, traffic analysis, header customizations, and css customizations.

Yearly Indexes: 2003 2004 2006 2007 2008 2009 2010 2011 2012 2013 2015 2019 2020 2022