Version 4 of Wikit configuration

Updated 2002-11-12 22:37:30

Wikit supports a number of configuration settings, defined by a number of configuration variables:

WIKIT_BASE
Set this to define the URL of the wiki pages - this causes generated pages to always refer to wiki pages with this base location (no more cgi-bin URLs), see below for more info.
WIKIT_CACHE
Set this to a writable dir, and wikit will save new pages in HTML form in this area. This can be used with Apache to maintain a fast-access page cache so most accesses never launch CGI.
WIKIT_CSS
Set this to the URL of the style sheet to use, and wikit will become CSS-enabled.
WIKIT_DUMP
This is a debug facility, set this to a writable file and all accesses will append info to that file.
WIKIT_HIST
Set this to a writable directory, and wikit will save every modified page in raw text form, under a unique name. It also appends entries to a ".index" text file in there. This is used by the Tcl'ers Wiki to move all page edits into a CVS repository (this is an independent cron script).

Static page access in Apache

There is a way to make Apache use static page copies, based on an error-redirect trick. The idea is to make all pages static, and remove them from the cache when edited. An access to a page which is not in the cache forces a CGI call, which generates the page and updates the cache.

Here's what I do to make this work:

  • say the area you want to present is "mywiki"
  • create a "mywiki/" dir, writable for CGI (usually user apache, www, or nobody)
  • create a file "mywiki/.htaccess" containing:
        ErrorDocument 404 /mywiki/nph-blah.cgi
        DirectoryIndex /mywiki/nph-blah.cgi/0
        Options MultiViews
  • create a file "mywiki/nph-blah.cgi" containing:
        #!/bin/sh
        echo HTTP/1.0 200 OK
        cd /path/to/my/datafile
        WIKIT_BASE=http://<mysite>/mywiki/
        export WIKIT_BASE
        WIKIT_CACHE=/path/to/mywiki
        export WIKIT_CACHE
        #WIKIT_CSS=http://url/of/my/style/sheet.css
        #export WIKIT_CSS
        # uncomment following as needed
        #WIKIT_DUMP=/path/to/mywikilogfile
        #export WIKIT_DUMP
        #WIKIT_HIST=/path/to/mywikihistdir
        #export WIKIT_HIST
        exec /path/to/tclkit wikit.kit mywikit.tkd
  • (add "-readonly" at the end to make the wiki readonly)

The "Options MultiViews" cause an access for page "123" to be satisfied when file "123.html" is present.


Hmmm... is WIKIT_CACHE really available?? It doesn't seem to work at all. Also, just a wee small thingy, can WIKIT_CACHE be /path/to/my/htdocs? Will that work? I generally do not want people to be able to poke their browsers into my cgi area ;^)

12nov02 jcw - Yes it is, that's how the Tclers' Wiki is set up. The trick is the redirect everything to a CGI. So what you do is create a dir just for the cache, make that the public one, i.e. the "real" public area, then redirect page misses to a CGI elsewhere, telling that CGI to update this area. When it does, the page will exist, i.e. not trigger an error from then on, hence be served statically. If you follow what I'm saying...


Category Wikit