Using Zope on a third-party web host
Created by .
Last modified on 2003/08/05.
DISCLAIMER 2001: I currently do not use Zope for application development and therefore cannot really provide constructive answers to questions raised by this How-To. I also no longer use csoft.net as a provider and they no longer support running Zope. See http://www.csoft.net/csoft-faq.html#What_about_Zope_ And finally, this How-To was originally written almost one year ago and as such may not be 100% accurate for newer versions of Zope.
DISCLAIMER 2000: Before configuring a v-host account like this, please double check your host's policies regarding long-running processes. The host I used when I wrote this was, at the time, very flexible with long-running processes such as Zope, but yours may not be. I hereby disclaim any damages or loss of service related to the steps outlined below; caveat emptor.
After I evaluated Zope on my home machine and started using it to develop a web site, I wanted to use it to revamp and improve upon another web site I run. The problem was, I only evaluated and started using Zope on machines that I had full, administrator access to. The web site I wanted to revamp is on a third-party hosting site where I don't have much control.
I searched through mailing list archives but couldn't find a suitable solution that would work on the provider I use (csoft.net). I figured out a solution that is only slightly awkward and works fine for my uses, so I am posting it here for others to use.
Hopefully this will allow more people to evaluate Zope and more people to use the product on third-party virtual hosts.
Some configuration details about csoft.net's servers before I outline the solution. You'll have to take these into account if you adapt this to another provider.
* telnet/ssh access is provided
* necessary compilers/interpreters (gcc and python) are installed
* CGI scripts can run anywhere in the www tree as long as they have the .cgi extension
* scripts can be called with or without their extension -- i.e. as long as there are no other files starting with "zope" you can call zope.cgi with either zope or zope.cgi in the URL
* htaccess files can be used for authentication
* your CGI scripts are run under your UID
The solution (adapt to your provider):
* unpack zope into your home directory (I named my folder ~/zope)
* go into ~/zope and run: python w_pcgi.py
This will compile and prepare Zope for use
* edit your ~/zope/start script to read as follows (this turns off the web, FTP, and monitor servers as well as turning off debugging)
#! /bin/sh
reldir=`dirname $0`
PYTHONHOME=`cd $reldir; pwd`
export PYTHONHOME
exec /usr/bin/python \
$PYTHONHOME/z2.py \
-w '' \
-f '' \
-m ''
* edit the "access" file (or create it if it doesn't exist yet) and put in one line:
superuser:
(You can name the user whatever you like. Remember the colon after the username; do not put anything after the colon though)
* cd ~
* htpasswd -c zopeusers superuser (This will prompt you for the superuser password. Change superuser to whatever name you want your superuser to be)
* cd ~/www (this is the root document folder on csoft.net accounts)
* cp ~/zope/Zope.cgi ./zope.cgi (Copy the zope CGI script to your root document folder. I actually called mine domain.cgi so I can go to www.domain.cgi/domain/folder/etc but you can name it whatever you like
* mkdir manage; cd manage (This will make a management folder that will authenticate your password. This is where it gets just a tad klugey)
* create a .htaccess file in this folder containing this:
AuthType Basic
AuthName Zope-realm
AuthUserFile /path/to/your/home/zopeusers
require valid-user
* cp ../zope.cgi . (This provies your manage folder with access to Zope)
I hope I didn't leave any steps out. Here is how you view and manage your new Zope installation based on the instructions above:
* to view your Zope objects as normal, just go to http://www.domain.com/zope/ (or http://www.domain.com/zope.cgi/ if you cannot leave off the trailing .cgi)
* to view your Zope management interface, you need to go to http://www.domain.com/manage/zope.cgi/manage and authenticate yourself. You can actually view your Zope web here by leaving off the last /manage but you will still need to authenticate yourself.
Some notes:
* if you want to add users to the Zope interface, add them there with no passwords. Then, go to your home directory and type "htpasswd zopeusers username" to add/change a user in the password list that apache uses.
* if you need to use Zope as your index file, use your index file in your root document folder to redirect. For instance, since csoft.net supports PHP, I can create a small one-line index.php3 file to accomplish this very quickly:
<? Header('Redirect: http://www.domain.com/zope/'); ?>
Please let me know if there are any improvements you can see in this setup, or any pitfalls I have not yet discovered.
|