DokuWiki

It's better when it's simple

User Tools

Site Tools


farms

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
farms [2016-09-02 13:10] – [DokuWiki Farms] andifarms [2023-09-22 23:11] (current) Klap-in
Line 3: Line 3:
 A wiki farm is a collection of wikis running on the same web server and sharing one parent wiki engine. So, by running just one single parent wiki, you can power hundreds of independent other wikis (aka "animals"). All animals share one set of plugins and templates but each of them can have a different set of enabled plugins, a different template and a different configuration. The concept of farms is also called "multi-site", "multi-domain" or "sub-sites" in the context of other CMS. A wiki farm is a collection of wikis running on the same web server and sharing one parent wiki engine. So, by running just one single parent wiki, you can power hundreds of independent other wikis (aka "animals"). All animals share one set of plugins and templates but each of them can have a different set of enabled plugins, a different template and a different configuration. The concept of farms is also called "multi-site", "multi-domain" or "sub-sites" in the context of other CMS.
  
 +===== Setup with Farmer Plugin =====  
 There are multiple ways to achieve running a wiki farm. Probably the easiest way is to use the [[plugin:farmer|Farmer Plugin]] which will set up the farm for you and provides means to create and manage the animals. There are multiple ways to achieve running a wiki farm. Probably the easiest way is to use the [[plugin:farmer|Farmer Plugin]] which will set up the farm for you and provides means to create and manage the animals.
 +
 +===== Manually Setup =====
  
 This page describes how to //manually// set up a farm in the easiest and most straightforward way to run a wiki farm with DokuWiki. More [[farms:advanced|advanced setups]] and tips are described on a separate page. This page describes how to //manually// set up a farm in the easiest and most straightforward way to run a wiki farm with DokuWiki. More [[farms:advanced|advanced setups]] and tips are described on a separate page.
Line 78: Line 81:
 In the farmer directory, copy ''./inc/preload.php.dist'' to ''./inc/preload.php'', open it and uncomment the two relevant lines and set your farm directory, so that it looks like this: In the farmer directory, copy ''./inc/preload.php.dist'' to ''./inc/preload.php'', open it and uncomment the two relevant lines and set your farm directory, so that it looks like this:
  
-<code php>+<code php inc/preload.php>
 // set this to your farm directory // set this to your farm directory
-if(!defined('DOKU_FARMDIR')) define('DOKU_FARMDIR', '/var/www/farm');+if (!defined('DOKU_FARMDIR')) define('DOKU_FARMDIR', '/var/www/farm');
  
 // include this after DOKU_FARMDIR if you want to use farms // include this after DOKU_FARMDIR if you want to use farms
-include(fullpath(dirname(__FILE__)).'/farm.php');+include(fullpath(dirname(__FILE__)) . '/farm.php');
 </code> </code>
- 
-Note: If you don't have DokuWiki version Adora Belle (2012-10-13) or newer, those two files will be missing. In that case you can simply copy them over from here: [[https://raw.github.com/splitbrain/dokuwiki/master/inc/farm.php|farm.php]] and [[https://raw.github.com/splitbrain/dokuwiki/master/inc/preload.php.dist|preload.php.dist]]. 
  
 Note: the path that you enter for ''DOKU_FARMDIR'' may need to be based on the "true" path to the server directory (as revealed by the PHP variable ''$_SERVER['DOCUMENT_ROOT']''). Sometimes using a symbolic link does not work. For example, even if you normally access your farm server directory as "/public_html/farm", you might need to enter something like "/home/<htmlusername>/public_html/farm". Note: the path that you enter for ''DOKU_FARMDIR'' may need to be based on the "true" path to the server directory (as revealed by the PHP variable ''$_SERVER['DOCUMENT_ROOT']''). Sometimes using a symbolic link does not work. For example, even if you normally access your farm server directory as "/public_html/farm", you might need to enter something like "/home/<htmlusername>/public_html/farm".
Line 105: Line 106:
 If you're not used to server configuration, this is the only more complicated bit. FIXME This and the following needs elaboration. If you're not used to server configuration, this is the only more complicated bit. FIXME This and the following needs elaboration.
  
-=== a. Virtual Host Based Setup ===+The alternatives are presented in processing order in inc/farm.php. If a .htaccess-based setup is recognized, the virtual server setup is ignored. 
 + 
 +=== a. .htaccess Based Setup === 
 + 
 +This ''.htaccess'' file needs to be put into the farm directory. Remember to enable .htaccess in the Apache Configuration (AllowOverride All) 
 + 
 +<code apache .htaccess>                                                                                                  
 +RewriteEngine On 
 + 
 +RewriteRule ^/?([^/]+)/(.*)  /dokuwiki/$2?animal=$1 [QSA] 
 +RewriteRule ^/?([^/]+)$      /dokuwiki/?animal=$1 [QSA] 
 +Options +FollowSymLinks 
 +</code> 
 + 
 +Change the ''/dokuwiki/'' part to the path to the farmer. 
 + 
 +=== b. Virtual Host Based Setup ===
  
 For this setup you have to configure the [[wp>Virtual_hosting|virtual host]] for each new animal in your web hosting control panel or ''httpd.conf'' Here is the ''httpd.conf'' example for ''subdomain.example.com'': For this setup you have to configure the [[wp>Virtual_hosting|virtual host]] for each new animal in your web hosting control panel or ''httpd.conf'' Here is the ''httpd.conf'' example for ''subdomain.example.com'':
Line 120: Line 137:
 On most shared hosts environments you only need to add the **server name** (your desired domain with or without subdomain) and the **document root** (always pointing to the farmer directory) through their GUI. On most shared hosts environments you only need to add the **server name** (your desired domain with or without subdomain) and the **document root** (always pointing to the farmer directory) through their GUI.
  
-=== b. .htaccess Based Setup ===+In some cases, a **generic approach** may be applied as wellFor this, you don't need modifications in the apache configuration when you add a farm animalGeneric Apache configuration:
  
-This ''.htaccess'' file needs to be put into the farm directory. Remember to enable .htaccess in the Apache Configuration (AllowOverride All) +<code apache> 
- +<VirtualHost *:80> 
-<code apache .htaccess                                                                                                 +    ServerName example.com 
-RewriteEngine On +    ServerAlias *.example.com 
- +    VirtualDocumentRoot /var/www/%-2/%-3 
-RewriteRule ^/?([^/]+)/(.*)  /dokuwiki/$2?animal=$1 [QSA] +    RewriteEngine On 
-RewriteRule ^/?([^/]+)$      /dokuwiki/?animal=$1 [QSA] +</VirtualHost>
-Options +FollowSymLinks+
 </code> </code>
  
-Change the ''/dokuwiki/'' part to the path to the farmer.+Each subdomain is automatically mapped to /var/www/example.com/<subdomain>. This arrangement makes sense when several domains point to the same server. In each of these subdomain directories, a symlink to the dokuwiki code directory must be created.
  
 +Each individual animal itself is in ''DOKU_FARMDIR/<subdomain>.example.com'' (mirrors the original URL).\\
 +This path must be created and the animal template (see above) may be copied herein.
 ==== 5. Change the admin password ==== ==== 5. Change the admin password ====
  
Line 146: Line 164:
 ===== Discussion ===== ===== Discussion =====
  
-You can add questions and requests to the [[farms:discussion|discussion page]].+Please use the [[https://forum.dokuwiki.org|Forum]] to discuss questions regarding farm setup. Be sure to mention if you did a manual setup or used the farmer plugin. 
 + 
 +===== Examples ===== 
 + 
 +One example for setting a farm has been detailed [[farms:example01|here]]. 
farms.1472814608.txt.gz · Last modified: 2016-09-02 13:10 by andi

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki