WebDAV Configuration
Next, we need to edit that httpd-dav.conf file we just enabled. Since we're already in the apache2 directory, just change directory into the extra directory, and edit that file, remembering to sudo again. On OS X, the default file should look like this:
# # Distributed authoring and versioning (WebDAV) # # Required modules: mod_dav, mod_dav_fs, mod_setenvif, mod_alias # mod_auth_digest, mod_authn_file # # The following example gives DAV write access to a directory called # "uploads" under the ServerRoot directory. # # The User/Group specified in httpd.conf needs to have write permissions # on the directory where the DavLockDB is placed and on any directory where # "Dav On" is specified. DavLockDB "/usr/var/DavLock" Alias /uploads "/usr/uploads" <Directory "/usr/uploads"> Dav On Order Allow,Deny Allow from all AuthType Digest AuthName DAV-upload # You can use the htdigest program to create the password database: # htdigest -c "/usr/user.passwd" DAV-upload admin AuthUserFile "/usr/user.passwd" AuthDigestProvider file # Allow universal read-access, but writes are restricted # to the admin user. <LimitExcept GET OPTIONS> require user admin </LimitExcept> </Directory>
You can go ahead and delete everything after the DavLockDB "/usr/var/DavLock" line.
As noted in the Requirements, you should already have a cloud storage provider account, because we're going to need some information from it shortly. If you're not set up, go do that now, because next we're going to edit httpd-dav.conf to point to a folder associated with your cloud provider.
Here's what my configuration wound up looking like (added after the DavLockDB "/usr/var/DavLock" line):
Alias /dropdav "/Users/*USERNAME*/Dropbox" <Directory "/Users/*USERNAME*/Dropbox"> Dav On Order Allow,Deny Allow from all AuthType Basic AuthName WebDAV-Realm AuthUserFile "/usr/webdav.passwd" <LimitExcept GET OPTIONS> require user *USERNAME* </LimitExcept> </Directory>
Explanation time! Anywhere you see *USERNAME*, replace it with your true username on your computer. On Linux, you can replace /Users/ with /home/ in most cases. Windows Vista & 7 also use /Users/ although you might have to use C:\Users\... in order to get Apache to traverse the path correctly.
The alias line makes it so http://localhost/dropdav will traverse the file structure correctly to your cloud folder, without you having to type the path in, or jump through a bunch of configuration hoops.
The stuff between the Directory tags sets up all of what we need to get WebDAV working. As you might have noticed, I switched the AuthType to Basic from Digest, due to compatibility issues with some programs and Digest.
Apples' Pages supposedly doesn't have this problem. But since I connect over a VPN, having passwords sent in clear text isn't an issue.
If you are going the port-forwarding route, keep the Digest option and follow the instructions in the original file to create the username / password file.
Speaking of usernames and passwords, that's it there in the AuthUserFile directive. I left it in its default place to keep it away from other OS X users on the system. But on Linux, you might want to find a better hiding spot since a lot of stuff lives in /usr/.
Finally, we require the username to be used inside the <LimitExcept> tags. That username must exist in the password file.