I’ve been on a Getting Things Done kick lately and have taken a liking to OmniFocus for managing my projects. They have an iPhone version that can sync with your desktop copy through a WebDAV server (amongst other options like Bonjour and MobileMe).

Guess what. I had trouble setting up WebDAV on CentOS. But I figured it out. This one’s mainly for people running Google searches trying to figure this out like I had to.

Me + Linux = Slow

I have a love-hate relationship with my Linux server. On one hand, it’s super-reliable. I love that. But on the other hand, I’m a boob when it comes to running Linux commands from Terminal.

I get my Linux and PHP hosted at Vivio Technologies, which runs their servers off of CentOS by default. I highly recommend them if you’re looking for solid Linux hosting.

Setting up WebDAV on CentOS Servers

There were a few pages on the Web that talked about installing WebDAV on Linux. But none of it got me 100% there. Simon posted a great write-up on synchronizing OmniFocus via WebDAV on Gentoo Linux. Unfortunately, I was only able to get a forbidden error message from OmniFocus when setting up the sync point. Do follow his advice on enabling mod_dav and mod_dav_fs though.

My biggest lead for CentOS + WebDAV bliss was from Vivek Gite on nixCraft. Apparently CentOS will auto-include a file at /etc/httpd/conf.d/webdav.conf for WebDAV operations.

And he includes a sample of what you should include in this magical file if you’re looking to enable WebDAV in Apache:

<IfModule mod_dav.c>
    LimitXMLRequestBody 131072

    Alias /webdav "/home/httpd/webdav"
    <Directory /home/httpd/webdav>
        Dav On
        Options +Indexes
        IndexOptions FancyIndexing
        AddDefaultCharset UTF-8
        AuthType Basic
        AuthName "WebDAV Server"
        AuthUserFile /etc/httpd/webdav.users.pwd
        Require valid-user
        Order allow,deny
        Allow from all
    </Directory>
</IfModule>

You then need to create a password file for whatever location you specify for AuthUserFile. Do that with this command:

# htpasswd -c /etc/httpd/webdav.users.pwd tom

You will be prompted to enter a password, which will be populated in the password file.

One final tip that I didn’t get from either article was to change permissions for your WebDAV-able directory to 755. So for our above example, we would do this:

# chmod 755 /home/httpd/webdav

Restart Apache using apachectl restart, and you should be golden. Getting OmniFocus and the iPhone working is pretty easy once you have the damn server working correctly.

Did I forget anything?

Did I forget a step or anything? Check on the articles that I linked to and let me know in the comments so I can fix this.

Now I’m off to record and process my “stuff” so that I can feel assured that it will always be with me via my iPhone.