installation1Add my vote for this tag create new tag
, view all tags

How To: Multiple TWiki Sites on a Single Installation

I copied most of this intro from the page about it on my personal web site at http://ian.kluft.com/opensource/multiple-twiki-installation.html

It's possible to run more than one TWiki site with a single installation of TWiki. The configuration file is usually used like a flat text file. But it's a series of Perl variable assignments. And it is itself a Perl script. It is possible to add Perl code to make TWiki detect the domain in which an incoming request was directed, and select configuration settings based on the incoming request.

How it started

I developed this for the Stratofox Aerospace Tracking Team in April 2004 in order to create separate private discussion web sites for the May 17 "CSXT Space Shot 2004" (in which CSXT claimed a flight altitude of 72 miles or 380,000', the first amateur rocket launch to space) and the June 7 Paragon Space Launch (which launched but experienced an in-flight failure and did not reach space). This trick was later used to set up public TWiki sites for
  • svwux.org (SVWUX, the Silicon Valley Wireless Users and eXperimenters)
  • linuxpicnic.org (Linux Picnic, annual celebration of the anniversary of Linus Torvalds' Aug 1991 public release of the Linux Kernel)

and a public wiki for Stratofox as well.

How to do it

The changes which I made to the configuration file were not extensive. This is what it took to make all those TWiki sites listed above work on one Apache HTTPD server.

This only involves changes to TWiki.cfg or LocalSite.cfg.

Add this near the top before anything that uses it:

# capture server name so this can be used for multiple TWiki's
$ENV{SERVER_NAME} =~ /^([A-Z0-9_.-]+)/i;
$server_name = $1;
$server_name =~ s/^www\.//;

Replace these entries:

$defaultUrlHost   = "http://$server_name";
$pubDir           = "/home/httpd/$server_name/twiki/pub";
$dataDir          = "/home/httpd/$server_name/twiki/data";
$wikiHomeUrl      = "http://$server_name/twiki";

Just set up twiki's in the directories where the server will look for them by name with this configuration. As configured here, they'll be found if they're in /home/httpd/websitedomainname/twiki . Adjust for your preferred path in TWiki.cfg.

How it works

Here's a summary of how it works.

  • Capture the SERVER_NAME from the CGI environment provided by the web server into the $server_name Perl variable.
  • Use $server_name to set the $defaultUrlHost, $pubDir, $dataDir and $wikiHome Url configuration variables, instead of using static assignments.
  • The directories named by these paths must already exist with twiki/data and twiki/pub directories in order for the separate TWiki site to work.
  • The twiki/bin and twiki/lib directories and twiki/.htaccess file can be symbolic links to your single TWiki installation directory for the server.
  • Using symlinks to the code helps you to upgrade TWiki later.


  • twiki-meetup-20071129.ppt: Running multiple virtual Twiki sites in a single installation (PowerPfffftttt exported from OpenOffice)

-- Contributors: IanKluft - 30 Nov 2007


Nice, but this fails in a mod_perl/speedy/fastcgi setup because the cfg files are only read once during compile time. So all wikis will have the same configuration of the first domain that got requested as all perl code is cached from thereon.

-- MichaelDaum - 30 Nov 2007

Your instructions seem similar to those written by Nato in the Advanced section of TWikiOnDebian smile - Though presonally, I wonder why you'd want to de-collaborate in this way.

-- SvenDowideit - 30 Nov 2007

Thank you Ian for sharing this with the TWikiCommunity!

All: Please be nice to folks who try to participate!

-- PeterThoeny - 03 Dec 2007

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatodp twiki-meetup-20071129.odp r1 manage 13.0 K 2007-11-30 - 07:20 IanKluft Running multiple virtual Twiki sites in a single installation (OpenOffice Impress)
PowerPointppt twiki-meetup-20071129.ppt r1 manage 62.5 K 2007-11-30 - 07:21 IanKluft Running multiple virtual Twiki sites in a single installation (PowerPffftttt exported from OpenOffice)
Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2007-12-03 - PeterThoeny
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.