Outlook-compatible WebDav with Nginx

Mon 10 November 2014 by feld

Microsoft Outlook has a Publish Online feature for sharing specific calendar information by publishing iCal files to WebDav. I don't use Apache on my personal servers, so here's how to configure it on Nginx.

You first need to ensure that you have both Nginx WebDav modules installed. They are called http_webdav and webdav_ext. You need the webdav_ext as Outlook attempts some specific functions that are provided by this module. Other calendar clients may not have the same requirements.

After you have both of these installed you can configure your webdav share like this:

server {
        listen  80;
        listen  [::]:80;
        server_name cal.yourdomain.com;
        root /usr/local/www/caldav;

        location / {
                dav_methods     PUT DELETE MKCOL COPY MOVE;
                dav_ext_methods     PROPFIND OPTIONS;
                create_full_put_path    on;
                dav_access      user:rw  group:rw  all:r;

You should probably secure this with SSL and possibly password protect your webdav share. Using the limit_except Nginx feature you could be clever and allow read access from everyone but prevent publishing without a password. This will prevent your server from being a target for public file storage. :-)

    limit_except GET {
        auth_basic "Restricted for authorized users!";
        auth_basic_user_file        /usr/local/etc/nginx/htpasswd;