OmniFocus syncing with Apache 2.2 WebDAV

In my quest to get back on the GTD wagon, I decided to spring for a copy of OmniFocus for both the Mac and the iPhone.   One neat feature is the ability of the app to use WebDAV to store the database on a web server and then sync between the two versions remotely.  I will probably always have my phone with me when I am using my laptop, so I don’t know how critical this feature will be for me.  However it does provide for a remote backup of the data, plus allows me to pull the data down when I want it instead of having to remember to sync “one more thing” on the phone before heading out the door.  You can use a MobileMe account to do this, but since I’m a cheapskate I had to figure out how to do this with the servers I already pay for.  A quick google search showed some nice blog posts on getting this setup using Mac OS X Leopard, but I wanted to run this on my Ubuntu server. So here’s basically what’s needed. First, make sure you have apache2 installed. I won’t cover that here. You need to enable mod_dav and mod_dav_fs.

sudo /usr/sbin/a2enmod dav
sudo /usr/sbin/a2enmod dav_fs

I also wanted ssl enabled so I wasn’t sending credentials in the clear. Turns out that the ssl certificate script (apache2-ssl-certificate) that most tutorials mention is not included with apache anymore. But you can do basically the same with the ssl-cert package, so install that as well as openssl if it’s not installed already. One problem is the cert is only good for one month, so if ignoring the warning you get from OmniFocus bothers you, you can fix that later by generating a cert with a longer expiration, or getting a real one.

sudo aptitude install openssl
sudo aptitude install ssl-cert

This should create a certificate and put it in /etc/ssl/private/localhost.pem. Then enable the ssl module and the ssl configuration on apache.

sudo a2ensite ssl
sudo a2enmod ssl

Then, create an htpasswd file that will be used to authenticate for your directory. I put mine in /etc/apache2.

sudo htpasswd -cs webdav.passwd username

Then follow the prompts.

You need to setup your config for the ssl part of your server, it will be in /etc/apache2/sites-enabled.   You need to pick a location on your server to host the data.   Whereever you put it, make sure it’s owned by the user that apache runs as:

sudo chown -R www-data:www-data data/

Here’s a sample config:

<VirtualHost *:443>
SSLEngine On
SSLCertificateFile /etc/ssl/private/localhost.pem
Alias /data "/opt/data/"
<Directory "/opt/data">
Dav On
Order Allow,Deny
Allow from all
AuthType Basic
AuthName WebDAV-Realm
AuthUserFile "/etc/apache2/webdav.passwd"
require valid-user

Just restart your server and hopefully everything is setup.

sudo apache2ctl graceful

You can check it from a browser by navigating to, assuming no other apache strangeness has been configured.

Leave a Reply

Your email address will not be published. Required fields are marked *