History: InstallVirtualHosting
Preview of version: 5
This page documents how to setup multiple tiki sites with virtual hosting on Apache, using a single copy of the Tiki code.
In this example let's host 4 domains:
- feu.org is a community website
- localis.org is a developpers website
- cynt.org is a personnal website
- tikiwiki.org is a free software development community
Setup 4 separate databases in the normal fashion.
Edit Apache virtualhost settings (I striped rewrite rules stuff that you can find elsewhere). where :
IP is your server IP or * if you use the ))NameVirtualHost(( directive
DOMAIN is your domain name (feu.org for example)
DOCROOT is where you have put your tikiwiki source tree (/usr/local/tikiwiki for example)
<Directory DOCROOT> Order allow,deny Allow from all </Directory> # put one block like that per domain to host <VirtualHost IP> 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" <FilesMatch "\.(bak|inc|lib|sh|sql|tpl)$"> order deny,allow deny from all </FilesMatch> <FilesMatch "^\.#"> order deny,allow deny from all </FilesMatch> </VirtualHost>
Then create the required directories. The best way to do this is to run the setup.sh command with extra parameters, like this:
"setup.sh www-data mose 02775 tiki_feu tiki_localis tiki_cynt tiki_org"
Alternatively, you can create the required directories manually like this:
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 file /usr/local/tikiwiki/db/local.php (there are some commented tips in file db/tiki-db.php) and put something like that (adapt it to your context):
<?php $host_tiki = 'localhost'; $user_tiki = 'tiki'; $pass_tiki = 'tiki'; if (($_SERVER["SERVER_NAME"] == "localis.org") or ($_SERVER["SERVER_NAME"] == "www.localis.org")) { $dbs_tiki = 'tiki_localis'; $tikidomain = 'localis'; } elseif .... { .... } else { # do you have a default setting $dbs_tiki = 'tiki_feu'; $tikidomain = 'feu'; } ?>
Here is done. for my own convenience I also setup a directory local/ with one subdir for each domain for disk storage of contents (set in admin panels).
Templates are common, one theme per site is maybe the right solution.
Here is it. any suggestion is welcome, and bugfixes are enjoyed !
History
| Information | Version | |||||
|---|---|---|---|---|---|---|
| Baraka Kinywa | 17 | |||||
| Xavier de Pedro moved back from doc.tw.o | 16 | |||||
| Marc Laporte fix link | 15 | |||||
| mlpvolt | 14 | |||||
| Mose | 13 | |||||
| Xavier de Pedro some info added as a newbie friend got stack due to lack of that information while starting his first ever Tiki installation...(and he ended up following this manual first) | 12 | |||||
| Marc Laporte inverted ''user'' and ''group'' | 11 | |||||
| Jeremy Butler Removed < ? php from code listing because it was confusing Mozilla/IE. Applied some doc formatting. | 10 | |||||
| Stephan Borg | 9 | |||||
| Stephan Borg | 8 | |||||
| van_woods | 7 | |||||
| Dennis Heltzel | 5 | |||||
| Dennis Heltzel | 4 | |||||
| Mose updated with SERVER_NAME rather than HTTP_HOST | 3 | |||||
| Mose | 2 | |||||