Hosting many domains with one TikiWiki and multiple databases Documentation »  Install Tiki

InstallVirtualHosting

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(external link)
    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):
$host_tiki="localhost";
$user_tiki="root";
$pass_tiki="";
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!


Contributors to this page: xavi5408 points  , marclaporte44401 points  , mlpvolt429 points  , mose4370 points  , jbutler71 points  , wolff_borg36 points  , van_woods24 points  and dheltzel64 points  .
Page last modified on Sunday 25 October 2009 21:02:31 CET by xavi5408 points .

Switch Language

Subscribe to Tiki Newsletters!

Delivered fresh to your email inbox!
Newsletter subscribe icon
Don't miss major announcements and other news!
Contribute to Tiki

Shoutbox

Torsten2431 points , 14:06 CEST, Sun 22 Apr. 2012: Next Webinar at Thursday, 17th of May 2012 (21:00 UTC)at http://tiki.org/live
Torsten2431 points , 11:43 CEST, Tue 10 Apr. 2012: Next Webinar at Thursday, 19th of April 2012 (21:00 UTC) at http://tiki.org/live
Jyhem2569 points , 13:07 CET, Fri 16 Mar. 2012: What happened to the BBB room ?
Torsten2431 points , 01:44 CET, Sat 25 Feb. 2012: Next Webinar at Thursday, 15th of March 2012 (21:00 UTC) at http://tiki.org/live
Torsten2431 points , 13:29 CET, Fri 10 Feb. 2012: Next webinar at Thursday, 16. of Feb. 2012 (21:00 UTC) at http://tiki.org/live