|
ZAP FAQ
Created by .
Last modified on 2003/08/02.
- What is Zap?
- Zap is Zope plus Apache in precompiled form. To install it, one need
only download, extract (or install the .rpm) and run the zap/start
script in the top level Zope directory.
- What platforms does Zap support?
- Linux. Zap was compiled on an out-of-the-box RedHat Linux 5.2
machine. It should work with no problems on any RedHat instalation,
and other Linux instalations that use the same version of glibc that
RedHat 5.2 uses (Zap has not been tested on RH 5.0, 5.1, or any other
distribution, please send your success or failure stories to the
Zap project owner listed on the Zap page so this paragraph can be
updated). Making Zaps for other versions/distributions of Linux
should be a trivial exercise.
- Will there be a (insert your favorite OS here) port of Zap?
- Not officialy. But we encourage you to attempt to create your own
Zap for your platform of preference. The method of making your own
Zap is, compile an Apache for your platform, compile a Zope for your
platform, glue them together by reverse engineering the Linux port,
test it, tarball it up and send it to the Zap project owner (listed
on the Zap page).
- What is Zope?
- Zope is a Web Application Platform written in Python. It is too cool
to detail in this documentation, you should see the Zope Site. Specificly, see the answer
to the question: What is
Zope?
- What is Apache?
- Apache is the coolest web server on earth. It's fast, reliable, and
free. You can get it from the Apache
Project. Your mom wants you to use Apache.
- Do I need to use Zap? Can't I use my Apache?
- If your using recent vesion of Apache, and you have mod_rewrite
compile/loaded in, then yes. There are exceptions which is why there
is Zap.
- Do I need to use Apache? Can I use any other Web Server?
- You can use any server that supports CGI with Zope, but your server
must be able to pass the Authentication HTTP header to the script.
In particular Zope comes with it's own HTTP server for testing use,
called ZopeHTTPServer. Digital Creations has also released an alpha
version of it's next generation of Zope products called ZServer,
based on Medusa, a
high speed TCP/IP server that allows you to publish objects over HTTP
and FTP.
- Why is using Zope with Apache tricky?
- Because Zope needs the HTTP Authentication header. The way CGI
communicates with the program it spawns is through the environment.
It is considered a (minor) security hazard to place user names and
passwords into a processes environment, since this envoronment can be
seen from other processes with a bit of effort. This is why Apache
wants to do the Authentication itself, and only call Zope's CGI
wrapper when it knows that the user is valid. This is not a problem
when running Zope in native servers (like ZopeHTTPServer or ZServer)
because these methods to not need a seperate Zope process, or in
non-UNIX servers (like IIS).
- What is mod_rewrite?
- mod_rewrite is the Swiss Army Knife of URL manipulation. Zope uses it
to trick Apache into setting the HTTP Authentication header to an
environment variable. To find out if your apache has mod_rewrite
compiled/loaded in, run
apache -l to get a list of all modules the
server is currently using.
- Where does this RewriteRule go?
- RewriteRules can go in the server's .conf file, in either the main
section or a VirtualHost section. They can also go in the .htaccess
file to set up Zopes on a directory by directory basis, but to quote
the mod_rewrite manual:
Unbelievably mod_rewrite provides URL manipulations in per-directory
context, i.e., within .htaccess files, although these are reached a
very long time after the URLs were translated to filenames (this has
to be this way, because .htaccess files stay in the filesystem, so
processing has already been reached this stage of processing). In
other words: According to the API phases at this time it is too late
for any URL manipulations. To overcome this chicken and egg problem
mod_rewrite uses a trick: When you manipulate a URL/filename in
per-directory context mod_rewrite first rewrites the filename back to
its corresponding URL (which it usually impossible, but see the
RewriteBase directive below for the trick to achieve this) and then
initiates a new internal sub-request with the new URL. This leads to a
new processing of the API phases from the beginning.
Again mod_rewrite tries hard to make this complicated step totally
transparent to the user, but you should remember here: While URL
manipulations in per-server context are really fast and efficient,
per-directory rewrites are slow and inefficient due to this chicken
and egg problem. But on the other hand this is the only way
mod_rewrite can provide (locally restricted) URL manipulations to the
average user.
- So what is the RewriteRule?
- For the latest version of Apache (1.3.4) the RewriteRule is
In your httpd.conf file:
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule ^/Zope(.*) /absolute/path/to/Zope.cgi$1 \
[e=HTTP_CGI_AUTHORIZATION:%1,t=application/x-httpd-cgi,l]
(The \ above means that the Rule should be all on one line)
What this does, in a nutshell, is rewrite the URL http://../Zope to
the Zope.cgi script. The RewriteCond is there to smell out the HTTP
Authorization header, which is then set to the environment variable
HTTP_CGI_AUTHORIZATION.
For other versions of Apache (1.3b is the one I know of) the rule is
different by one character. Add a / at the end of the first Zope
:
RewriteRule ^/Zope/(.*) etc...
- I have a Web Hosting Provider with a non-compliant Apache.
- First, if your provider is not interested in helping you, find
another one that is. Chances are if you go for the bargain basement
hosting prices you'll get bargain basement service. If you provider
is willing to change some things for you, the easiest path would be
to have them install a copy of Zap just for you. Otherwise, you will
need to specify to them that you need a recent version of Apache with
mod_rewrite installed. If your looking for a hosting provider that
is Zope-friendly, check out our list of Zope hosting
providers. Tell 'em the Zap FAQ sent ya.
Troubleshooting
Many people have initial dificulty getting Zope to work with their
particular Apache. This is one of the reasons why Zap was created, to
give a proof-of-concept implimentation of Zope and Apache working well
together. If you are having trouble getting Zope to work with your
Apache, read over the troubleshooting steps below. The best way,
however, to get your Zope and Apache to start talking is to download
Zap and study it's configuration.
- Zap doesn't work!
- The Apache binary that comes with Zap was compiled on a RedHat 5.2
Linux machine. The C libraries that RH 5.2 links against may not be
compatable with your system. In this case your only choice is to
compile your own Apache. More important than the binary, however, is
the configuration file that comes with Zap. As long as you can
compile an Apache that has the mod_rewrite module either compiled in
or dynamicly loaded (be warned that some users have reported problems
with dynamic loading, and had to compile mod_rewrite in) then you can
use the Zap httpd.conf file as a template to get your Apache working.
- I extracted Zap in my Zope directory, what do I do from here?
- Read the README.txt. The long answer is, run the ./startzap script
and hit http://localhost:9673/. If it says "It worked!" then yes, it
worked.
- startzap keeps saying, "Apache did NOT start successfuly".
- Check your Zap/logs/zap_error_log file. The very last entry in the
log file should be the reason why Apache did not start successfuly
(Zap will politely show you the last 10 lines of this logfile for you
if Apache won't fire up. If you want to change the error log file
name be sure to edit the startzap script acordingly). This problem
is commonly caused by having some other web server (like
ZopeHTTPServer) listening on the same port that Zap wants to listen
on (9673).
Apache starts up, but when I go to http://yourhost:9673/Zope Zope
says "Sorry, a SERIOUS APPLICATION ERROR occoured" --
This rather ominous error message means that pcgi could not start up
the Zope process. View the HTML source and look at the traceback,
this should give you a clue as to why Zope won't start up. Could
you, by chance, have another Zope process running off the same
directory?
- I keep getting a '404 Not Found'
- Apart from the idioticly obvious (making sure you typing in the
right URL) chances are your RewriteRule doesn't work. If you are not
using The Zap distribution, there can be many reasons why. First,
make sure you are using a recent version of Apache, this has been
verified with all the 1.3 series. There have also been reports
of problems with dynamicly loaded mod_rewrites not working. In this
case the module may need to be compiled in. Digital Creations cannot
test and verify every combination of Apache/mod_rewrite/Zope. If we
worked that hard we'd never get anything done. If after verifying
seperately that you have a recent Apache and that you have mod_rewrite
installed and it still doesn't work, try turning your RewriteLogLevel
to 9 (Make sure you have a RewriteLog specified) and sniffing around
from there.
- I keep getting a '403 Bad Request'
- Your RewriteRule is kicking in, but the Rule is malformed. There have
been changes to the mod_rewrite somewhere between 1.3b and 1.3.4. The
RewriteRule that comes with Zap-1.0.0 works for 1.3b. The Rule that
comes with Zap-1.1.0 works for 1.3.4.
|