|
Table of Contents
How to create a DokuWiki farm with symlinksHere I describe the symlink approach to create a dokuwiki farm. This wiki was created using this approach. Features of this Approach
Installation of the Farm WikiThis is the only complete instance of DokuWiki.
# path to the farm (ends without /): farmpath=/var/www/dokuwiki-farm cd `dirname $farmpath` # adapt the link for an other version: wget http://www.splitbrain.org/_media/projects/dokuwiki/dokuwiki-rc2010-10-07.tgz tar -xzvf dokuwiki-*.tgz # rename the folder from dokuwiki-YYYY-MM-DD to your farm folder name: mv dokuwiki-*/ $farmpath cd $farmpath chown -R www-data:www-data data/ conf/ cat > inc/preload.php <<'EOF' <?php $dir = dirname($_SERVER['SCRIPT_FILENAME']); if(is_dir($dir . '/conf')) define('DOKU_CONF', $dir . '/conf/'); else { $dir = preg_replace('#lib/(exe|plugin.*)#', 'conf/', $dir); if(is_dir($dir)) define('DOKU_CONF', $dir); } ?> EOF # the next step is only needed for the older dokuwiki-2009-12-25c! cp lib/exe/indexer.php{,.orig} patch lib/exe/indexer.php <<'EOF' 263,265c263,265 < < if(@file_exists(DOKU_INC.$sitemap)){ < if(!is_writable(DOKU_INC.$sitemap)) return false; --- > $sitemap_path=DOKU_CONF.'../'; > if(@file_exists($sitemap_path.$sitemap)){ > if(!is_writable($sitemap_path.$sitemap)) return false; 267c267 < if(!is_writable(DOKU_INC)) return false; --- > if(!is_writable($sitemap_path)) return false; 270,271c270,271 < if(@filesize(DOKU_INC.$sitemap) && < @filemtime(DOKU_INC.$sitemap) > (time()-($conf['sitemap']*60*60*24))){ --- > if(@filesize($sitemap_path.$sitemap) && > @filemtime($sitemap_path.$sitemap) > (time()-($conf['sitemap']*60*60*24))){ 303c303 < io_saveFile(DOKU_INC.$sitemap,$data); --- > io_saveFile($sitemap_path.$sitemap,$data); EOF Now you can configure your dokuwiki-farm as you like. The configuration will be the template for the animal wikis. Disabling Plugins for each Animal individually
With this patch, the plugins are disabled based on the existence of the file
cd $farmerpath/inc cp -a plugincontroller.class.php plugincontroller.class.php.dist patch -p0 plugincontroller.class.php <<'EOF' --- plugincontroller.class.php.dist 2010-01-17 11:35:46.000000000 +0100 +++ plugincontroller.class.php 2010-04-01 14:08:21.000000000 +0200 @@ -104 +104 @@ - return @unlink(DOKU_PLUGIN.$plugin.'/disabled'); + return @unlink(DOKU_CONF.'plugin.'.$plugin.'.disabled'); @@ -111 +111 @@ - return @touch(DOKU_PLUGIN.$plugin.'/disabled'); + return @touch(DOKU_CONF.'plugin.'.$plugin.'.disabled'); @@ -125 +124,0 @@ - @@ -130 +129 @@ - }elseif(@file_exists(DOKU_PLUGIN.$plugin.'/disabled')){ + }elseif(@file_exists(DOKU_CONF.'plugin.'.$plugin.'.disabled')){ EOF Creation of an Animal Wiki
Configuration of the Apache Virtual Host for the Animal and mod_rewrite
First, we enable URL rewriting with
# This is what stands after the domain name http://animal1.example.org/wiki/ (ends without /): animalbasedir=/wiki # Turn RewriteEngine on, adapt RewriteBase and create the .htaccess file sed 's@RewriteBase /dokuwiki@RewriteBase '$animalbasedir'@g' > $animalpath/.htaccess <<'EOF' ## You should disable Indexes and MultiViews either here or in the ## global config. Symlinks maybe needed for URL rewriting. Options -Indexes -MultiViews +FollowSymLinks ## make sure nobody gets the htaccess files <Files ~ "^[\._]ht"> Order allow,deny Deny from all Satisfy All </Files> ## Uncomment these rules if you want to have nice URLs using ## $conf['userewrite'] = 1 - not needed for rewrite mode 2 RewriteEngine on # ## Not all installations will require the following line. If you do, ## change "/dokuwiki" to the path to your dokuwiki directory relative ## to your document root. RewriteBase /dokuwiki # ## If you enable DokuWikis XML-RPC interface, you should consider to ## restrict access to it over HTTPS only! Uncomment the following two ## rules if your server setup allows HTTPS. #RewriteCond %{HTTPS} !=on #RewriteRule ^lib/exe/xmlrpc.php$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301] # RewriteRule ^_media/(.*) lib/exe/fetch.php?media=$1 [QSA,L] RewriteRule ^_detail/(.*) lib/exe/detail.php?media=$1 [QSA,L] RewriteRule ^_export/([^/]+)/(.*) doku.php?do=export_$1&id=$2 [QSA,L] RewriteRule ^$ doku.php [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) doku.php?id=$1 [QSA,L] RewriteRule ^index.php$ doku.php EOF Now we configure the virtual host for the animal.
animalhostname=animal1.example.org cd /etc/apache2/sites-available tee $animalhostname <<'EOF' <VirtualHost *:80> ServerName $animalhostname DocumentRoot $animalpath/ <Directory $animalpath> Options FollowSymLinks AllowOverride All </Directory> </VirtualHost> EOF ln -s $animalhostname ../sites-enabled/. # reload config to enable the virtual host /etc/init.d/apache2 reload
Enable config:userewrite and set config:basedir appropriately in the
cd $animalpath cat >> conf/local.php <<EOF \$conf['basedir'] = '$animalbasedir/'; \$conf['userewrite'] = '1'; EOF Comments |