View on
Andrew Maltsev > XAO-Web > Apache::XAO



Annotate this POD

View/Report Bugs
Module Version: 2.01   Source  


Apache::XAO - Apache XAO handler


In httpd.conf or <VirtualHost ..> section:

 PerlFreshRestart   On
 PerlSetVar         SiteName        testsite
 SetHandler         perl-script
 PerlTransHandler   Apache::XAO


Apache::XAO is provides a clean way to integrate XAO::Web based web sites into mod_perl for maximum performance. The same site can still be used in CGI mode (see XAO::Web::Intro for configuration samples).

Apache::XAO must be installed as PerlTransHandler, not as a PerlHandler.

If some areas of the tree need to be excluded from XAO::Web (as it usually happens with images -- /images or something similar) these areas need to be configured in the site's configuration. This is described in details below.

As a convenience, there is also simple way to exclude certain locations using Apache configuration only. Most common is ExtFilesMap:

 PerlSetVar         ExtFilesMap     /images

This tells Apache::XAO to map everything under /images location in URI to physical files in 'images' directory off the project home directory. For a site named 'testsite' this is roughly the same as the following, only you do not have to worry about exact path to site's home directory:

 Alias              /images         /usr/local/xao/projects/testsite/images

To achieve the same effect from the site configuration you need:

 path_mapping_table => {
     '/images' => {
         type        => 'maptodir',

More generic way is to just disable Apache::XAO from handling some area altogether:

 PerlSetVar         ExtFiles        /images

In this case no mapping is performed and generally Apache::XAO does nothing and lets Apache handle the files.

Site configuration equivalent is:

 path_mapping_table => {
     '/images' => {
         type        => 'external',

More then one prefix can be listed using ':' as separator:

 PerlSetVar         ExtFilesMap     /images:/icons:/ftp


Using Apache::XAO gives of course incomparable with CGI mode performance, but even in comparision with mod_rewrite/mod_perl combination we got 5 to 10 percent boost in performance in tests.

Not to mention clearer looking config files and reduced server memory footprint -- no need to load mod_rewrite.

For additional improvement in memory size it is recommended to add the following line into the main Apache httpd.conf (not into any VirtualHost):

 PerlModule XAO::PreLoad

This way most of XAO modules will be pre-compiled and shared between all apache child thus saving memory and child startup time:




Copyright (c) 2005 Andrew Maltsev

Copyright (c) 2001-2004 Andrew Maltsev, XAO Inc.

<> --


Recommended reading: XAO::Web::Intro, XAO::Web, XAO::DO::Config, Apache.

syntax highlighting: