Multisite DokuWiki Install

I wanted to be able to install DokuWiki with a single code base serving multiple wikis. This would have several advantages especially making updates easier.

There are a variety of ways of doing this, and thus a variety of instructions around the web. I used the instructions here and this is what I did.

For the purposes of this post I will be using /var/www/dokuwiki as the directory containing the Dokuwiki code and thus the ‘farmer’ in my setup. I created a folder /var/www/wikis/ to contain all the ‘animals’. So for a wiki named ‘mydocs’ the filesystem path would be /var/www/wikis/mydocs and the URL would be http://www.mydomain.tld/wikis/mydocs

Download DokuWiki and extract. There should now be a directory named ‘dokuwiki’. Remove the install.php file and create the preload.php file:

rm ./dokuwiki/install.php
cp ./dokuwiki/inc/preload.php.dist  ./dokuwiki/inc/preload.php

Uncomment the two lines referring to farm in preload.php

vi ./dokuwiki/inc/preload.php

so the file should look like:

// set this to your farm directory
if(!defined('DOKU_FARMDIR')) define('DOKU_FARMDIR', '/var/www/wikis');

// include this after DOKU_FARMDIR if you want to use farms
cd ./wikis
cp -R _animal mydocs
vi ./wikis/mydocs/conf/local.protected.php
$conf['savedir'] = DOKU_CONF.'../data';
$conf['updatecheck'] = 0;
$conf['basedir'] = '/wikis/mydocs/';

Amend Apache Conf or .htaccess

If your host allows using .htaccess you can add the following in a .htaccess file inside your dokuwiki directory OR if you have access to the Apache conf files you could add the following directives there:

<Directory /var/www/wikis>
RewriteEngine On
RewriteRule ^/?([^/]+)/(.*)  /dokuwiki/$2?animal=$1 [QSA]
RewriteRule ^/?([^/]+)$      /dokuwiki/?animal=$1 [QSA]
allow from all

<DirectoryMatch "/dokuwiki/(data|conf|bin|inc)/">
order allow,deny
deny from all
satisfy all

Adding More Animals / Sub Wikis

Copying the _animal directory with a new name should give you a new wiki but you will need to amend the basedir path in the local.protected.php file within that new wiki folder, and also ensure that each of the directories under data for the new wiki are writeable for the web server user (e.g. www-data or apache).


You should be able to log in to the new wiki with admin/admin so you will want to remove that user from ./wikis/{newwikiname}/conf/users.auth.php

Customising DokuWiki

  • The following template based on Bootstrap is nice (and maintained for the time being):
  • LDAP or Active Directory Authentication of users
  • Create a sidebar with a menu:
    • visit your wiki start page and at the end of url add ?id=sidebar
    • Then ‘Create this Page’
    • Add some content and save
    • The sidebar should appear
  • Create new namespaces as categories for your content: In the wiki search box enter the name for your new category with a colon at the end e.g. mynewcategory:start When you arrive on the page choose ‘Create this Page’. This will create a namespace called mynewcategory



Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>