11.3 Apache Configuration


Apache must be configured to handle Mason much as with Embperl. We will choose a directory and for all .html files under that directory, have Mason process them (for the same reasons, too).

First, create a directory for the Mason work:

 $  mkdir /var/www/html/mason  $  chmod a+rx /var/www/html/mason  

As root , add the following to /etc/httpd/conf/httpd.conf :

 PerlSetVar MasonCompRoot /var/www/html/mason  PerlSetVar MasonDataDir /var/www/misc/mason  PerlModule HTML::Mason::ApacheHandler  <Directory /var/www/html/mason>      SetHandler perl-script      PerlHandler HTML::Mason::ApacheHandler  </Directory> 

The first line sets the Mason component root directory to /var/www/html/mason . This tells Mason where to find the components (more on these later). The data directory is set to /var/www/misc/mason . The Mason data directory should not be under the HTML root directory ( /var/www/html ), because we want to hide the Mason data files from the Web surfer visiting our site. The data directory contains data files that Mason uses, so we have picked an innocuous place for Mason to put them. You do not have to create this directory; it and all of its subdirectories are magically created for you.

Apache directives should be defined for the directory /var/www/html/mason . They tell Apache to set the handler to perl-script and to use the HTML::Mason::ApacheHandler module for all files in the /var/www/html/mason directory.

Load the altered Apache configuration file:

 #  /etc/init.d/httpd graceful  


Open Source Development with Lamp
Open Source Development with LAMP: Using Linux, Apache, MySQL, Perl, and PHP
ISBN: 020177061X
EAN: 2147483647
Year: 2002
Pages: 136

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net