Based on an article by Jeep Hauser, published on GoLiveHeaven.com,
probably Copyright 2001 by Jeep Hauser. No longer available, but Google
has cached it (search for "webdav site:goliveheaven.com" without the
quotes).
Enabling WebDAV and publishing your iCal calendar
=================================================
This will work on a default installation of 10.2.
Type the commands exactly as shown. Case is important.
First make a backup copy of the Apache configuration file in case you
need to restore it. Open a Terminal window and type
sudo cp /etc/httpd/httpd.conf /etc/httpd/httpd.conf.org
Now make the directory where you'll serve the documents from:
cd /Library/WebServer/Documents
sudo mkdir DAVdocs
sudo chown www:www DAVdocs
Create a directory for WebDAV to store its locks and other data:
cd /Library/Webserver/
sudo mkdir DAVLock
sudo chown www:www DAVLock
Now that the basic folders are set up, edit httpd.conf using your
favorite text editor. BBEdit makes it trivially simple to edit files
that are owned by the superuser.
Find the line that says
#LoadModule dav_module libexec/httpd/libdav.so
Uncomment this line (remove the "#"). Now scroll down a one or two more
screens until you see the line,
#AddModule mod_dav.c
Uncomment that line as well.
IMPORTANT: if you are using Marc Liyanage's enhanced PHP module instead
of the one that ships with 10.2, you need to move the lines you just uncommented
to the ends of their respective sections so that mod_dav will load after mod_php4.
More info about this and other great OS X software can be found at
http://www.entropy.ch/software/macosx/
What you just did was to tell Apache to use the WebDAV modules. Now you
have to tell it what directories to use, and what kind of security you
want. You could theoretically have no security at all, but these days,
that's not a wise idea. WebDAV only supports basic authentication, but
it will do for now. You will have to manually create users and their
passwords, but you will have fewer worries about prying eyes.
Scroll down a few more screens in the httpd.conf file until you get to a
section that reads:
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
Just below this comment, insert the line
DAVLockDB /Library/WebServer/DAVLock/DAVLock
A few lines further down you should see a section that reads
#
# This should be changed to whatever you set DocumentRoot to.
#
[lots of stuff here]
Just beneath the closing tag, insert the following:
#
# Settings for WebDAV Server
#
#
DAV On
DAVMinTimeout 600
DAVDepthInfinity On
AllowOverride AuthConfig
AuthName "DAV Restricted"
AuthType Basic
AuthUserFile /Library/WebServer/users
Require valid-user
This sets the directory DAVdocs to be your WebDAV-enabled directory,
with Basic Authentication checking against the /Library/WebServer/users
file.
Save httpd.conf.
The first time you create a user for authentication, you will also need
to create a file that will contain all the users for our WebDAV
directory. To set this up type the following in the Terminal:
cd /Library/Webserver
sudo htpasswd -c users davuser
You'll be prompted for a password, and asked to confirm it.
What this just did was create the htpasswd file "users" and add the user
"davuser". To add more users to the same file, type the same "htpasswd"
command, but don't type "-c" (that's used to create the file initially).
Now you need to create a .htaccess file (the period in front of the name
is required) in the root of your main WebDAV directory
(/Library/WebServer/Documents/DAVdocs). Put the following into your
.htaccess document:
AuthName "DAV Restricted"
AuthType Basic
AuthUserFile /Library/WebServer/users
require valid-user
Save the file, then change the owner:
sudo chown www:www /Library/WebServer/Documents/DAVdocs/.htaccess
Finally, restart the webserver:
sudo apachectl graceful
If you get any message other than "httpd gracefully restarted",
something messed up. If you need to restore the original Apache
settings, type the following in the Terminal:
sudo cp sudo cp /etc/httpd/httpd.conf.org /etc/httpd/httpd.conf
Now that your WebDAV server is running, you can publish your iCal
calendar to it. The URL will be
http://YourHostNameHere/DAVdocs/
Users subscribe to
http://YourHostNameHere/DAVdocs/CalendarName.ics.
You must enable Advanced Options and enter the userid and password you
set up.