Skip to main content

Moving Dokuwiki To A New Server

server apps wiki

A big advantage of a no-SQL wiki like Dokuwiki is that you can easily move it. All the non-media content is stored as text files, as a branch called data/pages within the same directory tree as the code. That makes it feasible to carry a clone of it on your laptop, or even a USB stick. Here’s a quick guide on how to move or copy an entire wiki from one Apache server to another.

Back up the wiki
#

Change to the directory on the old server where you installed dokuwiki, and archive everything in that folder:

cd /usr/local/webapps/dokuwiki
tar cvzf ~/dokuwiki-backup.tgz .

Restore it
#

Create the new wiki directory, unpack your backup into it, and set permissions so that it’s accessible by the web server:

cd  /var/www/myapps
sudo mkdir mywiki
cd mywiki
sudo tar xvzf ~/dokuwiki-backup.tgz .
cd ..
sudo chown -R www-data:www-data mywiki

If the relative path to your new wiki will be the same as the old one (default: /dokuwiki/), you’re done. Proceed to the Apache configuration, below. If not, edit conf/local.php and add a line with the new path:

$conf['baseurl'] = '/mywiki/';

Apache configuration
#

Assuming that Apache is already working to serve other web pages, the cleanest way is to create a new configuration file in /etc/apache2/conf.d/ directory, e.g. dokuwiki.conf. This configuration allows unrestricted access from any computer:

Alias /mywiki /var/www/myapps/mywiki
<Directory /var/www/myapps/mywiki>
        Options FollowSymLinks
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
</Directory>

If you changed the relative path in conf/local.php above, and you’re using Apache’s rewrite engine with Dokuwiki, then edit the .htaccess file in the top directory of your Dokuwiki to match it:

RewriteBase /mywiki

Now restart Apache and you’re ready to browse your new site:

sudo service apache2 restart

For other tips on installing and customizing your wiki, search this blog for the word dokuwiki.

Related

Dokuwiki Tutorial Part 2: Navigation and Appearance
server apps wiki
Part 1 of our Dokuwiki tutorial series covered installation and basic wiki page editing.
Dokuwiki Tutorial Part 1: Install and First Pages
server apps wiki
Dokuwiki is a wiki for small teams that’s easy to learn and a cinch to manage.
Dokuwiki: Small Footprint, Big Features
server apps wiki
Wikis are a valuable business tool.