Virtual Hosting Install

This is an Installation Guide.

This page is out of date from before multitiki functionality added in 1.7. Refer to MultiTiki for recent information.

This page documents how to set up multiple Tiki sites with virtual hosting on Apache, using a single copy of the Tiki code. For a single installation on a virtual server see: Installation.

In this example let's host 4 domains:

  • feu.org is a community website
  • localis.org is a developers website
  • cynt.org is a personal website
  • tikiwiki.org is a free software development community

Create Tiki databases

Set up 4 separate databases in the normal fashion.

Setup Virtual Hosting in Apache

Edit Apache virtualhost settings (I stripped rewrite rules stuff that you can find elsewhere) where :

IP your server IP or * if you use the ))NameVirtualHost(( directive
DOMAIN your domain name (feu.org, for example)
DOCROOT where you have put your tikiwiki source tree (/usr/local/tikiwiki, for example)
Order allow,deny
Allow from all

# put one block like this per hosted domain

  ServerName DOMAIN
  ServerAlias www.DOMAIN
  DocumentRoot DOCROOT
  ErrorLog /var/log/apache/DOMAIN-error_log
  Customlog /var/log/apache/DOMAIN-access_log combined
  php_flag magic_quotes_gpc Off
  php_value "include_path" ".:lib:lib/pear:/usr/share/pear"
    order deny,allow
    deny from all
    order deny,allow
    deny from all

Create Directories

Then create the required directories. The best way to do this is to run the setup.sh command with extra parameters. Its usage is

./setup.sh user [group] [rights] [list of virtual host domains]

user and group are those of the Webserver. Our example would look like this:

setup.sh mose www-data 02775 feu localis cynt tiki

Alternatively, you can create the required directories manually like this:

mkdir backups/feu
mkdir backups/localis
mkdir backups/cynt
mkdir backups/tiki
mkdir templates_c/feu
mkdir templates_c/localis
mkdir templates_c/cynt
mkdir templates_c/tiki
mkdir modules/cache/feu
mkdir modules/cache/localis
mkdir modules/cache/cynt
mkdir modules/cache/tiki
chown -R www-data:mose template_c modules/cache

Edit Database Configuration

You need to edit the file which contains database/s information (db/local.php).

If this is the first time you install tiki on your document root, then the easiest way is to point your browser to the Web address that corresponds to the file tiki-install.php in the Tiki document root you created above.

  • E.g. http://localhost/tiki/tiki-install.php
    This will create that file for you through filling some fileds through a web interface
  • If you have problems you should check InstallTikiUnderSafeMode

Then edit the file db/local.php (there are some commented tips in file db/tiki-db.php) and put something like this (adapt it to your context):

if ($_SERVER["HTTP_HOST"] == "feu.org") {
	$dbs_tiki    = 'feu';
	$tikidomain  = 'feu';
} elseif ($_SERVER["HTTP_HOST"] == "localis.org") {
	$dbs_tiki    = 'localis';
	$tikidomain  = 'localis';
} elseif ($_SERVER["HTTP_HOST"] == "cynt.org") {
	$dbs_tiki    = 'cynt';
	$tikidomain  = 'cynt';
} elseif ($_SERVER["HTTP_HOST"] == "tikiwiki.org") {
	$dbs_tiki    = 'tiki';
	$tikidomain  = 'tiki';
} else {
	// default case, your choice is to block or open to a default domain

Now you are ready to test it (you did restart Apache, right?).

For my own convenience I also set up a directory, local/, with one subdirectory for each domain for disk storage of contents (set in Tiki admin panels).

Templates are common to all four Tikis. One theme per site is maybe the right solution.

Any suggestions or corrections to this page are welcome!

Page last modified on Sunday 25 October 2009 20:02:31 GMT-0000