Manual:Wiki family/th

Below are instructions for how to set up MediaWiki to host more than one wiki. Multiple wikis located on the same server are called a wiki-family or wiki farm. A list of known wiki farms is available on.

Wiki farm
The following steps are for running multiple wikis on same version of MediaWiki:
 * 1) Install the first wiki as normal. For details, see.
 * 2) Enable your web server to share your MediaWiki install with all wikis. For multiple (sub)domains, you can use listen on multiple server names. For multiple subdirectories, you could use rewrite rules, aliases, or symlinks.
 * 3) Add code to the top of , to detect the current wiki. Note that if the argument to   contains a hyphen, the argument will be split on the hyphen and the resulting two values assigned to   and  , respectively. For wikis by domain name:
 * 4) Configure settings that must differ for all wikis. For example:
 * 5) Configure per-wiki overrides. This should include at least   and  . This could be done from a separate file, e.g.:

To create a new wiki, create its database and add its settings first, and then run.

Separate settings files
This approach is for operating entirely independent wikis, but still sharing the same web server and MediaWiki source code.

As with the above wiki farm example, a  argument containing a hyphen will be split on the hyphen into two values assigned to   and , respectively.
 * 1) Install the first wiki as normal, via the web or CLI installer, which sets up your database and generates a  file.
 * 1) After installation, rename the generated   file to include the wiki ID (e.g. database name), like.
 * 1) Repeat step one and two above for each wiki you wish to create.
 * 1) Create a new   file that will load the correct one.

If your wikis are on the same domain but under different paths (e.g.,   etc.), you can use something like this:

Drupal-style sites
This setup has the advantage of being completely transparent to users and reasonably secure in terms of the images directory.


 * 1) Create a base directory to contain all your MediaWiki files e.g..
 * 2) Install MediaWiki and additional tools as usual to a version-declaring subdirectory (e.g.,  ).
 * 3) Link the version-declaring directory to a code directory. e.g.,
 * 4) Create a sites directory to contain our images and settings:
 * 5) Setup the wiki as normal from the /code directory.
 * 6) After successful installation, move   into a sites directory that will be a match when the site is checked. For example, to capture http://example.com/mywiki, one would create the directory example.com.mywiki. e.g.,  . See the Drupal's   file for more information on this.
 * 7) If you intend to use media files, create an images directory in your site directory. e.g.,  .  Make it writable as necessary.
 * 8) Place the Drupal-style   file in your main directory:
 * 9) Modify the   of each subsite to point to the right places:
 * 10) First comment out the code relating to , (lines 16-20 in 1.15.3) as this is set to the code directory by.
 * 11) Next insert the following two lines to ensure that image files are accessible, e.g.:  and . These need to be put somewhere after the call to   (line 25 in 1.15.3), as the variables will otherwise be reset.
 * 12) Make further modifications as required.
 * 13) Prepare your Apache 2 installation. Example site: wiki.example.com
 * 14) Create a link to the code directory, if required e.g.
 * 15) Create an appropriate VHost configuration:
 * 11. If you are setting the sites up locally, update your  file with the site names. The site should now work.

In my case, I made another copy of the code from which to install and update my  and databases. Note that in the companion Drupal code is undefined when running maintenance scripts from the command line, so this solution does not permit the use of maintenance scripts without some modification.

Modified Drupal-style method for Ubuntu
A simplified method for multiple wikis and multiple (or nested) subwikis on Ubuntu/Kubuntu that is loosely based on the above method can be found at:
 * Ubuntuguide.org MediaWiki tips

Tips for sharing between wikis
You can use to share uploaded media files across wikis. This is similar to Wikimedia Commons for Wikipedia.

For example:


 * en.example.org -
 * fr.example.org -
 * de.example.org -
 * pool.example.org - Shared media files for all wikis.

Shared database tables
Consider using a shared database for user accounts. See for instructions on setting up shared database tables.

Interwiki
You can create interwiki links between all wikis, by using. If the wikis are language editions, it is recommended to name the interwiki prefix after the exact language code. For example, "de" for the German wiki in your family. This way, you can connect pages about the same subject using language links.

Adding Hauptseite on your English "Main Page" will create a link "Deutsch" in the languages sidebar. For further information visit

If you have a central wiki for files, create a prefix for this as well. E.g.  to https://pool.example.org/wiki/$1 and enable the "Forward" checkbox to recognise it as a local wiki in the same family.

Upload
Make sure that folder "images" of the pool-wiki is writable.

It is useful to change the "Upload file"-Link of the language-wikis to point to poolwiki's upload-site. Open the "LocalSettings.php" of each language-wiki and add:

In 1.17, you'll also have to set  to be redirected to the pool-wiki on red links.

If you want to allow uploads only for your pool wiki, you may use something like this:

Use shared files
To use poolwiki's files in the languagewikis, open "LocalSettings.php" for each languagewiki and add:

Now you can integrate pool's files with (e.g. ) in the languagewikis.

Image description
In each languagewiki, open (as an admin) the message MediaWiki:Sharedupload-desc-here.

Change the text to something like:

This file is stored in our data-pool. For information and description, please visit the description there.

(And note the ':' at the beginning of the line, which stops 'pool' from being included in the interwiki list at the left of the page.)

If you want to output the media-description, stored in the PoolWiki, too, add to the "LocalSettings.php" of the languagewikis:

Wiki Farm extensions
There are several MediaWiki extensions that attempt to simplify hosting of several wikis by using just one code base, however only one is currently noteworthy:


 * - beta.


 * : For localisation issues of the and customising the Skins regarding the files ,  ,  ,  ,  ,   respectively.

ดูเพิ่ม

 * Configuration database
 * MediaWiki Farmers user group and Wikifarm
 * — the mechanism by which user accounts can have an extra 'central' identifier.