Table of Contents

One Jaws to rule them all

Author: Jon Wood
Author: Pablo Fischer
Date: 17/01/2005

Over the next month I’m going to be working on getting multiple sites running from a single database, and this is where I’ll put anything that’s happening about that.

This document is a work in progress.


Running multiple sites from a single database not only allows the obvious - running them from one database, but also allows other benefits from the code required to allow this. Please add any others you can think of.

  • Multiple blogs etc. can be supported under a single site.
  • If desired, the same user database can be used across multiple sites.
  • Less maintanance is required - upgrade/install a gadget once, and it can be used across all your Jaws powered sites.

The Trick

The best idea to explain is to give an example:

Lets suppose we have a domain called: In we want to host the blog for each user. Currently we have two requests: one request is from Michael and the other is from Peter. They love to write in blogs and they love Jaws.

Also, we have in server Jaws installed in /usr/share/jaws.

To install Jaws to Michael and Peter we have the following solutions:

  • One solution is to copy all the directory of /usr/share/jaws/html to the public html directory of each user. However, how can we keep updated their Jaws installation?. Copying again all the directories to each user?. Just imagine that task if you have 50 tasks.
  • The other solution is that Jaws could deal with multiple configuration files, not just config.php. What I mean? Easy, think about having include/ and include/, each file with their own DB params (for example, the michael file can have a different username and peter other, etc..). So when someone visit the subdomain (already configured in apache virtualhosts), Jaws will try to get the domain where is being called and will look for the configuration file, if it doesn’t exists it will load config.php (the default).

But where is the damn trick!. The trick comes in a little shell script:

# cd /home/michael/public_html
# ln -s /usr/share/jaws/html .
# rm -rf resource
# mkdir resource
# cd resource
# mkdir xml phoo files banners

Why I removed the resource directory?. Easy, you don’t want Michael to share the original resorces (located in usr/share/jaws/html/resources).

A brief idea is at Drupal site, you can read it here

Although, we can implement prefixes in Database, so administrators running Jaws but with just one DB to work can change the prefix of the tables for each user, maybe: user_table, for example: user_blog, user_registry, etc..

  /var/www/wiki/htdocs/data/jaws/proposals/multiple_sites_from_one_db.txt · Last modified: 2007/11/02 16:27