Using Zope With Apache - The Fast And The Furious (
Page 5 of 7 )
Now, while the procedure on the previous page does seem to work in some
cases (at least according to all the documentation I read and some of
the posts in the online newsgroups), I have to admit that, despite my
best efforts, I was unable to get the URL rewriting to work correctly on
my system. If you had the same problem, then be of stout heart, because
there does exist an alternative solution.
This alternative is FastCGI, which works just as well, and is much
easier to install and use. First, untar the Apache distribution to a
directory on your system.
$ cd /tmp/sources
$ tar -xzvf apache_1.3.20.tar.gz
Next, untar the FastCGI distribution
$ tar -xzvf mod_fastcgi-2.2.12.tar.gz
and move the contents of the newly-created directory to
<apache-source>/src/modules/fastcgi
$ mv mod_fastcgi-2.2.12 apache_1.3.20/src/modules/fastcgi/
Configure Apache to activate this FastCGI module.
$ cd /tmp/sources/apache_1.3.20
$ ./configure --activate-module=src/modules/fastcgi/libfastcgi.a
In case you're wondering, no, there isn't an error in the line above -
the file "libfastcgi.a" doesn't exist at the moment, but it will soon.
Compile and install the package.
$ make
$ make install
At this point, you can verify that the FastCGI module has been compiled
into the server by executing the httpd binary with the "-l" parameter
(look for the entry "mod_fastcgi.c" in the resulting output)
Next, configure Apache so that it knows how to handle FastCGI. Pop open
Apache's "httpd.conf" file and add the following lines to it:
FastCgiExternalServer /usr/local/apache/htdocs/zope -host localhost:8889
-pass-header Authorization
<Location /zope>
SetHandler fastcgi-script
</Location>
The FastCgiExternalServer directive defines the file
"/usr/local/apache/htdocs/zope" as a FastCGI application, one that will
be started and stopped manually. It also means that any request for this
file from a client browser will automatically be handled by FastCGI.
The "-pass-header Authorization" argument to the FastCgiExternalServer
directive instructs Apache to pass authentication information to the
FastCGI application; this will (hopefully) solve the authentication
problems experienced with PCGI.
Now, shift the action over to Zope. You'll need to start Zope with a
couple of additional configuration parameters, so that it knows it needs
to use FastCGI. Here's how:
$ cd /usr/local/Zope/
$ ./bin/python z2.py -D -F 8889
This tells Zope to use FastCGI, and to run on port number 8889. If you'd
prefer to use a UNIX domain socket instead of a TCP port, you can
replace the port number with the path to the socket.
Zope should now start and run silently in the foreground.
Finally, start Apache.
$ /usr/local/apache/bin/apachectl start
At this point, you should be able to browse to the URL
http://your.server/zope/ and view the Zope screens. All content under
the /zope/ "directory" will be served up by Zope; all other content will
be served by Apache.
You'll notice, also, that if you go to the Zope management interface, at
http://your.server/zope/manage/, you'll have no trouble logging in (so
long as you have the right credentials). Thus, FastCGI very neatly
solves the authentication problem PCGI had - and that's why I'd
recommend this approach over the previous one.