Home arrow Zope arrow Page 5 - Using Zope With Apache

The Fast And The Furious - Zope

So you've got your Apache server serving up static HTMLcontent, and you've got some cool new Zope applications as well. Now, incase you were wondering, it is possible for the twain to meet - and thisarticle tells you how, with a step-by-step guide to the process ofserving up your Zope content through Apache.

TABLE OF CONTENTS:
  1. Using Zope With Apache
  2. A Few Good Reasons
  3. When Persistence Pays Off
  4. The Writing On The Wall
  5. The Fast And The Furious
  6. Performing By Proxy
  7. Zip Zap Zoom
By: icarus, (c) Melonfire
Rating: starstarstarstarstar / 30
May 14, 2002

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
Now, while the procedure on the previous page does seem to work in somecases (at least according to all the documentation I read and some ofthe posts in the online newsgroups), I have to admit that, despite mybest efforts, I was unable to get the URL rewriting to work correctly onmy system. If you had the same problem, then be of stout heart, becausethere does exist an alternative solution.

This alternative is FastCGI, which works just as well, and is mucheasier to install and use. First, untar the Apache distribution to adirectory 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 compiledinto 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 openApache'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 willbe started and stopped manually. It also means that any request for thisfile from a client browser will automatically be handled by FastCGI.

The "-pass-header Authorization" argument to the FastCgiExternalServerdirective instructs Apache to pass authentication information to theFastCGI application; this will (hopefully) solve the authenticationproblems experienced with PCGI.

Now, shift the action over to Zope. You'll need to start Zope with acouple of additional configuration parameters, so that it knows it needsto 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'dprefer to use a UNIX domain socket instead of a TCP port, you canreplace 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 URLhttp://your.server/zope/ and view the Zope screens. All content underthe /zope/ "directory" will be served up by Zope; all other content willbe served by Apache.

You'll notice, also, that if you go to the Zope management interface, athttp://your.server/zope/manage/, you'll have no trouble logging in (solong as you have the right credentials). Thus, FastCGI very neatlysolves the authentication problem PCGI had - and that's why I'drecommend this approach over the previous one.

 
 
>>> More Zope Articles          >>> More By icarus, (c) Melonfire
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

ZOPE ARTICLES

- Creating Zope Products
- Plone Content Types With Archetypes
- Flat User Management in Zope
- Creating Basic Zope Applications
- Getting started with Zope for Linux and Sola...
- ZPT Basics (part 4)
- ZPT Basics (part 3)
- ZPT Basics (part 2)
- ZPT Basics (part 1)
- Exception Handling In DTML
- DTML Basics (part 4)
- DTML Basics (part 3)
- DTML Basics (part 2)
- DTML Basics (part 1)
- Using Zope With Apache

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: