Apache2 now supported by mod_lisp and TBNL
Thursday, November 11, 2004
Last week, I discussed how to setup/configure
mod_lisp,
TBNL, etc. with Apache 1.3 on Win32. The mod_lisp module allows CL developers to use the popular
Apache web server with many CL implementations; however, one of the
complaints about mod_lisp in the past had been that it only worked
with the earlier 1.3 version of Apache, not the newer 2.0 version of
Apache (Apache 2.0 has a
number of new features that are not in Apache 1.3). That is no longer a problem - Marc Battyani, with
some prodding from Edi Weitz ;-), has finished off support for
Apache2. He
announced the availability today (darn - John Wiseman
beat me to the punch in blogging the announcement ;-)). Concurrent
with the mod_lisp2 announcement, Edi Weitz has released a new
version of
TBNL with support for Apache2 and mod_lisp2.
I installed Apache2 and the new mod_lisp2 and tried them out on
Win32. I only did some superficial testing, but everything seemed
to work fine. Basically, the steps I
outlined previously still apply with just a few minor changes. Here is
a revised version of the necessary installation/setup steps for Apache2:
- I downloaded and installed the Apache 2.0 binary distribution for Win32. When installing, I took all the defaults except for choosing to install it in "c:\bin\" rather than the default "c:\Program Files\Apache Group\" location. I elected to run Apache2 as a service so that I can easily start/stop/restart Apache2 from an icon in the Windows system tray. After installing, I started Apache2 and made certain that the Apache default page showed up in my browser when I went to "http://localhost".
- Marc Battyani provides a pre-built version of mod_lisp2 for Win32. So, I downloaded the zip file and extracted the contents into the "C:\bin\Apache2\modules" directory.
- Since mod_lisp2 only provides a low-level interface between Apache
and CL, I decided to use the
TBNL and
CL-WHO libraries that
Edi Weitz developed to provide a higher level of abstraction on
top of the mod_lisp2 layer. There are a number of pre-reqs for these
libraries, so I downloaded them as well and unpacked all of the
libraries under my "c:\usr\home\lisp" directory. Here are all the
CL packages that I downloaded:
- TBNL: A toolkit developed by Edi Weitz for building dynamic websites. It provides facilities like automatic session handling (with and without cookies), logging to Apache's log files, customizable error handling, and easy access to GET and POST parameters sent by the client.
- CL-WHO: A Lisp markup language developed by Edi Weitz for generating HTML from CL.
- KMRCL: A collection of general purpose utilities used by a number of Kevin Rosenberg's CL packages.
- MD5: An implementation by Pierre R. Mai of the cryptographic Message-Digest protocol from RSA Data Security, Inc.
- CL-BASE64: A library developed by Kevin Rosenberg for base64 encoding and decoding.
- CL-PPCRE: A portable regular expression library developed by Edi Weitz.
- URL-REWRITE: A small package developed by Edi Weitz which can be used to programmatically rewrite (X)HTML documents.
- ASDF: Most people will already have this one; however, I'm including it for completeness. It's Daniel Barlow's system definition facility and it's used for building all the other packages.
- I had to modify the Apache configuration file
"C:\bin\Apache2\conf\httpd.conf" so that requests for
dynamic content would be passed on to mod_lisp2 and TBNL. I decided
to use the test program that comes with TBNL as the dynamic request
handler so just put in the modifications that Edi
recommends:
LoadModule lisp_module modules/mod_lisp2.so ... LispServer 127.0.0.1 3000 "tbnl" <Location /tbnl> SetHandler lisp-handler </Location>
I subseqently stopped and re-started Apache so that the changes would be recognized. - I ran the following CL code to load the necessary
libraries and to start the example TBNL program:
(defvar *lisp-dirs* "c:/usr/home/lisp/" "Root location of CL library installs") (load (concatenate 'string *lisp-dirs* "asdf/asdf.lisp")) (setf asdf:*central-registry* '(*default-pathname-defaults* (concatenate 'string *lisp-dirs* "cl-base64-3.3.1/") (concatenate 'string *lisp-dirs* "cl-ppcre-0.9.0/") (concatenate 'string *lisp-dirs* "cl-who-0.4.3/") (concatenate 'string *lisp-dirs* "kmrcl-1.77/") (concatenate 'string *lisp-dirs* "md5-1.8.4/") (concatenate 'string *lisp-dirs* "tbnl-0.3.1/") (concatenate 'string *lisp-dirs* "url-rewrite/"))) (asdf:oos 'asdf:load-op :tbnl-test) (tbnl:start-tbnl)
- I then opened a browser and entered the URL "http://localhost/tbnl/test". A dynamically-generated page was generated and I could select from a list of options that produce other dynamically-generated pages.
- To shut things down, I entered "(tbnl:stop-tbnl)" in the CL REPL and manually stopped the Apache2 service.

