How to Install Multiple TikiWikis Using Subdomains on Windows XP

This page describes how to install multiple TikiWiki applications under one Apache web (HTTP) server using the â€œMultiTikiâ€-subdomain approach.

The PDF Document describing these steps can be found here:
MultiTiki Apache and Windows Configuration.pdf (390.57 Kb)

Environment:
Windows XP Professional 2002
Service Pack 3

TikiWiki-3.1
Apache HTTP Server 2.2
MySQL RDBMS 5.3.1

Apache, PHP, and MySQL were installed as part of installing XAMPP, so the locations of their respective directories may differ from what is on your machine.

The resulting installation will have one TikiWiki code-base (php, smary, javascript, etc.) and three distinct MySQL databases (housed under one MySQL relational database management system). TikiWikiâ€™s installer program will create additional directories for each sub-domain, that would not ordinarily be seen after installing a single TikiWiki application.

1. Create a directory in a location outside of Apacheâ€™s root directory.

In XAMPP, Apache serves up files out of the â€œhtdocsâ€ directory for example: C:\xampp\htdocs . On your machine Apache may serve files out of â€œwwwâ€ or â€œpublic_htmlâ€.

If you are not sure of what your root directory is, locate the httpd.conf file under the apache installation, and search for the following sectionâ€¦

In this document, I created a directory called subdomains (name it what you like) as followsâ€¦

â€œC:\subdomainsâ€

2. Unzip (or decompress) the TikiWiki-3.1.zip file.

In this example, I rename TikiWiki-3.1 to "taf" - the name of my application - so I end up with â€œC:\subdomains\tafâ€

You will serve-up TikiWiki out of this directory â€œC:\subdomainsâ€ , rather than Apacheâ€™s root directory.

3. Locate and create a backup of Apacheâ€™s â€œhttpd.confâ€ file.

In an XAMPP install, it can be found here:

C\xampp\apache\conf\httpd.conf

5. Locate the â€œhostsâ€ file on your Windows XP machine and add your subdomains.

It can usually be found at:

C:\WINDOWS\system32\drivers\etc\hosts

The host file will probably already contain a definition for â€œlocalhostâ€. Simply add your subdomain names immediately after it, separating each with one space â€œ â€œ. Here, I have chosen three subdomain names prefixed to â€œlocalhostâ€, with a dot â€œ.â€ in betweenâ€¦

127.0.0.1 localhost demo.localhost test.localhost pilot.localhost

6. Locate the â€œhttpd-vhosts.confâ€ file, in the â€œextraâ€ subdirectory at the following location.

C:\xampp\apache\conf\extra\httpd-vhosts.conf

If you do not have this file, you can probably create the same definitions within the â€œhttpd.confâ€ file, under the section for Virtual Hosts.

7. Define your virtual hosts as follows...

httpd-vhosts
NameVirtualHost *

<VirtualHost *>
ServerName pilot
DocumentRoot "C:/subdomains/taf"
</VirtualHost>

<VirtualHost *>
ServerName demo
DocumentRoot "C:/subdomains/taf"
</VirtualHost>

<VirtualHost *>
ServerName test
DocumentRoot "C:/subdomains/taf"
</VirtualHost>

# It is very important to get the syntax correct here.
#
# Put â€œNameVirtualHost *â€ at the top and for each of your subdomains putâ€¦
#
#    <VirtualHost *>
#    ServerName subdomain1
#    DocumentRoot â€œC:/path/to/your/subdomain/directoryâ€
#    </VirtualHost>
#
# Of course, â€œsubdomainâ€ should be replaces with one of your subdomain names,
# and the Document root should match what you created in the first step.
# Note the direction of the slashes â€œ/â€

8. Restart your Apache web server, after you have saved the changes to httpd.conf, hosts, and (possibly) httpd-vhosts.conf.

You are probably running it as a service on Windows XP, and you can restart it by doing the following: Start > Run > â€œservices.mscâ€ > OK > right-click Apache 2.2 --> select â€œRestartâ€

9. Create a local.php file for your TikiWiki-3.1/db directory.

In your TikiWiki install directory in this example, I renamed it â€œtafâ€ and it resides in a directory I named â€œsubdomainsâ€ , locate the â€œdbâ€ directoryâ€¦

C:\subdomains\taf\db

In the db directory, there may be a file named â€œlocal.phpâ€. If so, open it for modification. If not, then created a file by that name and enter the followingâ€¦

local.php for db directory
<?php
$db_tiki='mysqli';$dbversion_tiki='3.0';
$host_tiki='localhost';$user_tiki = 'root';
$pass_tiki = 'YourMySQLRootPassword'; if ($_SERVER["HTTP_HOST"] == "demo" || $_SERVER["HTTP_HOST"] == "www.demo") {$tikidomain = "demo.localhost";
$dbs_tiki = "demo"; } elseif ($_SERVER["HTTP_HOST"] == "test" || $_SERVER["HTTP_HOST"] == "www.test") {$tikidomain = "test.localhost";
$dbs_tiki = "test"; } elseif ($_SERVER["HTTP_HOST"] == "pilot" || $_SERVER["HTTP_HOST"] == "www.pilot") {$tikidomain = "pilot.localhost";
\$dbs_tiki = "pilot";
}
?>

For a breakdown...

10. In the â€œdbâ€ directory of your TikiWiki installation, create a new directory named after each of your subdomains.

In my exampleâ€¦

C:\subdomains\taf\db\demo.localhost
C:\subdomains\taf\db\test.localhost
C:\subdomains\taf\db\pilot.localhost

[Remember â€“ â€œtafâ€ is merely what I renamed my one-and-only TikiWiki-3.1 installation ]

12. Start the installer for your first domain, by entering "http://<first_subdomain>.localhost/tiki-install.php" in the address bar.

Here I type in http://demo.localhost/tiki-install.php. In my example, â€œdemoâ€ was the name of one of my subdomains. The following screen should be displayed upon entering the installer address...

This is important!

If things have gone well, you should see references to â€œMultiTikiâ€ displayed in the box on the left-hand side of the browser.

Since I typed in the subdomain for demo, the â€œdemo.localhostâ€ is bolded where it says â€œDB OKâ€. This indicates that the install is targeted for the database defined for the â€œdemoâ€ subdomain. The installer will create several subdirectories for each subdomain, within your original TikiWiki installation directory or â€œtafâ€ in my case. Run through these same install steps for each of your subdomains. Make sure that the given subdomain is â€œboldedâ€ when doing the install for it.

Do NOT lock the installer until after you have run it for your LAST subdomain.

On the last screen of the installer, you will be given the chance to enter your tikiwiki site with or without locking the installer. Choose NOT to lock the installer, until your have installed the tiki for your last subdomain.

If you mistakenly choose to lock the installer, merely delete the "lock" file found under the "db" directory of your MultiTiki code-base, and continue installing tiki for your remaining subdomains.

13. Other Procedures for Installing Multiple TikiWiki Instances

• TRIM - TikiWiki Remote Instance Manager

Related older pages

Page last modified on Wednesday 05 August, 2009 01:45:32 CEST by edmund.

Keywords

These keywords serve as "hubs" for navigation within the Tiki documentation. They correspond to development keywords (bug reports and feature requests):