· teach ·


this article will show you how to configure webDAV support for apache on your os x box, as to enable support for storing your ical calendars so you won't have to pay for .mac services. the webdav configuration settings throughout this document were originally found in an cached webdav article at goliveheaven written by jeep hauser, which are used throughout this document to set up webdav for integration with ical. the credit for the technical underpinnings goes to him.

requirements are a mac running os x 10.2 with root enabled, ical installed, and some knowledge of editing files in a unix shell using an editor such as vi or emacs. also, for access of your stored calendars from outside locations, you will need permanent broadband access for your mac, and know its ip address.


open up a new session in the Terminal Application, su to root, and execute the following commands:

cd /Library/Webserver/Documents
mkdir DAVdocs
mkdir ../DAVLock
chown www:www DAVdocs
chown www:www ../DAVLock

in the lines above we created the directories necessary for our setup, and changed the ownership permissions so that apache can access them correctly. now that we have prepared for the configuration changes, we will need to setup apache to work with webDAV.

apache configuration

change your directory to /etc/httpd/ and edit the file httpd.conf using the command emacs httpd.conf or your favorite editor's command. first we need to enable the webDAV module by searching for the following two lines [they are separate in the file] and uncomment them one at a time [remove the #]:

#LoadModule dav_module libexec/httpd/libdav.so

#AddModule mod_dav.c

next we will need to insert the appropriate apache directivies to identify our webDAV settings and preferences. insert it before the code block containing:

<Directory "/Library/WebServer/Documents">

the code block to insert is:

# Settings for WebDAV Server
DAVLockDB /Library/WebServer/DAVLock/DAVLock
DAVMinTimeout 600
DAVDepthInfinity On

<Directory /Library/WebServer/Documents/DAVdocs>
AllowOverride AuthConfig
AuthName "DAV Restricted"
AuthType Basic
AuthUserFile /Library/WebServer/users
Require valid-user

you are now done editing the apache configuration file, so please save it, and exit your editor [C-x C-s C-x C-c in emacs].


after setting up apache to be able to function with the webdav server, next we will secure the webserver so that ruffians will not attempt to also store their calendars and do various other malicious things to your beloved computer (like connect to it with goliath and screw with your files). to do this we will protect the DAVdocs directory with apache's built in access control. first let's create a the password file that apache will refer to for access control:

root# cd /Library/Webserver
root# htpasswd -c users davuser
New password:
Re-type new password:
Adding password for user davuser

the htpasswd command created a file called users and the first user created was called davuser. be sure to enter a secure password, and write it down in case you forget it. next we will create the .htaccess file to secure our DAVdocs directory. we will put this file in the directory we wish to protect, and it will reference the password file we created when the directory is accessed through a web browser. first change directory to /Library/Webserver/Documents/DAVdocs/ then create the new file called .htaccess containing the following text:

AuthName "DAV Restricted"
AuthType Basic
AuthUserFile /Library/WebServer/users

require valid-user

be sure to also chown www:www .htaccess also. our work is complete, so we must restart apache by either going to System Preferences->Sharing and stopping/starting Personal Web Sharing, or by typing apachectl graceful restart in the command prompt. next we are ready to test things out.


to test out what we've done, point your web browser to http://your.ip.or.hostname/DAVdocs/ and see if apache will prompt you for a username and password, if so enter davuser and the password you entered earlier. the directory should be empty right now.

fire up ical and select one of your calendars, then click Calendar->Publish in the drop down menu. Choose the 'Publish on a web server' option, and ical will prompt you for a url, username, and password. the url is the same http://your.ip.or.hostname/DAVdocs/ you tested earlier, and enter the same htaccess login information. your .ics should now be published, and is ready to be emailed to others for access, or ready for download on another mac [if you are lucky enough to have more than one in your home or office such as i].


apache, webdav, and ical should all be working together, and i hope you enjoy using them. keep in mind that if you are in the only one in your group of friends with a static ip on your broadband connection, you could set up your machine as the webDAV server for your group of friends. you can add more logins to the htpasswd file you created by typing htpasswd users name in the /Library/Webserver/ directory, where name is the username of the user you wish to add.

i am pleasantly surprised with ical considering it is only a 1.0 application at the time this article is being written, and it already appears quite stable and full of features. if you have any questions or comments regarding this article let me know at wall at shawnwall dot com.


© shawn wall 2000-2010 - validate: xhtml css view: rss
weblog about images teach links