Private Dokuwiki on multiple computers using Dropbox

Dropbox is a great tool, and due to it’s file sync capabilities it has a lot of possibilities to create “hack” solutions like the one that I’m going to describe here:

If you have a personal Wiki that you want to share between several computers, the usual “normal” way of doing so is to setup a 24/7 Web Server with Apache/Lighttpd and, in my case, installing Dokuwiki. Then the client PC’s to access the Wiki all they have to do is tto point their browser to access this web server. But what this means is that you really need to have a web server available 24/7 even  if not using it… And where to locate this web server? At my home? Pay hosting fees? And if I don’t have connection to it? And so on…

The solution is using Dropbox as your data repository for DokuWiki Content. Content is always available and replicated automatically on all computers, even if you don’t have internet access. You can even share your Wiki privately with your friends/family/colleagues by inviting them to the Wiki folder… and off course setting up Lighttpd on their computers.

How it works:

I’m using Lighttpd as the web server. For personal use is more than enough and it supports PHP5 and Dokuwiki just fine. Lighthttpd is installed in all computers that access the wiki.

The installation steps for Ubuntu/Kubuntu and derivatives are the following:

1) Install Lighttpd, php5 and dokuwiki packages: apt-get install lighttpd php5-cgi dokuwiki.

During installation of dokuwiki, it will be asked what web server should be configured automatically, namely Apache or lighttpd. We must choose the later, lighttpd by pressing space (so that a * should appear) and, if Apache is not installed, deselect Apache.

The following question is if, in case of dokuwiki package removal, should the wiki content ALSO be removed… We should answer NO.

Then, finally, the wiki admin password is asked.

After installation, the lighttpd server should start automatically, and using a browse the local web page http://localhost should show the default web server page.

Then follow these instructions http://redmine.lighttpd.net/wiki/lighttpd/TutorialLighttpdAndPHP#Configuration to enable Lighttpd with PHP5.

Basically is to edit the php.ini file that’slocated in /etc/php5/cgi/php.ini and the lighttpd.conf file located on /etc/lighttpd directory. These changes must be done as the user root (use sudo -s on a command shell).

Make sure that when pasting the fastcgi.server section into the lighttpd.conf file, the “bin-path” entry points to the php5-cgi binary, normally located at /usr/bin/php5-cgi

Save and restart the lighttpd server with the command /etc/init.d/lighttpd restart


2) Copy /usr/share/dokuwiki to /var/www with the following command:  cp -R /usr/share/dokuwiki /var/www and make sure the permissions are correct: chown -R www-data:www-data /var/www/dokuwiki

Note that the first copy command there are no trailing slashes.

3) You can rename the folder from dokuwiki to other name, like wiki, for example to change the URL. This is optional.

4) Create the Dokuwiki data directory on your Dropbox: mkdir -p ~/Dropbox/wiki/data This should be done in only ONE computer, the others will synchronize automatically.


5) Change the permissions on the directory: sudo chown -R www-data ~/Dropbox/wiki/data This should be done in ALL computers.

6) Edit the Dokuwiki configuration file dokuwiki.php located in /etc/dokuwiki and change the value of the line $conf[‘savedir’] to the data location on the dropbox folder. In my case I changed the default value from $conf[‘savedir’]=’/var/lib/dokuwiki/data’; to $conf[‘savedir’]=’/home/primalcortex/Dropbox/wiki/data’;

You must do this in all computers, only, probably, changing the Dropbox location. If you’re using the same username on all computers, just copy the file between them using Dropbox…

And that’s it. Accessing now the URL http://localhost/dokuwiki uses now the local lighttpd web server with all data synchronized between computers, and it works EVEN when offline. 

You now can invite your work colleagues to this folder, and have all data available at all times to anyone that uses the same scheme.

EDIT: You may find the following error when using the Wiki based on your Dropbox directory: The datadir (‘pages‘) does not exist, isn’t accessible or writable. You should check your config and permission settings.

The problem is file/directory permissions, because the user www-data used by lighttpd can’t access your home directory/Dropbox directory.

There are two solutions, being the easy one to add the www-data user to your own group, in my case the group named primalcortex.

The other solution is to add the following permissions: chmod o+x /home/username and chmod o+x/home/Dropbox

The first solution will be better because Dropbox software can or might change the Dropbox directory permissions. Just make sure that your home directory permissions are 750.

2 thoughts on “Private Dokuwiki on multiple computers using Dropbox

  1. Hi, thanks for writing these detailed instructions!
    Just one issue I’m having – everything went well until the very last step.. even after trying both solutions to the permissions problem, the error you mentioned persists and I can’t access the dokuwiki: “The datadir (‘pages’) does not exist, isn’t accessible or writable. You should check your config and permission settings. Or maybe you want to run the installer?”.

    Any ideas what else could be wrong here?
    Btw, I just put the basic fastcgi.server-code to the mod_fastcgi-file, not sure if the advanced settings were meant to be added too…

    1. One quick way to check what is failing is to do the following:

      1) Goto a root shell: sudo -s
      2) Impersonate the www-data user that is used by lighthttpd and dokuwiki
      3) Change directory to /home then to myuser, then to Dropbox and finnaly to wiki
      4) If successful, what is missing is write permissions to the wiki folder.
      5) If not, your home directory and or Dropbox folder are protected and permissions need to be granted.

      My permissions on my home folder is 755 (chmod 755 /home/primalcortex) and the same to the Dropbox folder.

      Also I found easier to just add to my .bashrc script these commands:

      chmod-R 777 ~/Dropbox/wiki

      But check first what are your security requirements.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.