6.6. Apache as a File Repository

One of the cooler things you can do with Apache is use it as a simple online file repository, with WebDAV. WebDAV, which stands for Web-based Distributed Authoring and Versioning, enables Apache to allow users to treat an enabled directory as a remote directory or drive on their own computers. Similar to a Windows share or NFS export, WebDAV allows remote editing and storage access, only using HTTP as the transport layer instead of a specialized TCP protocol or port like SMB and NFS.

To understand how WebDAV works as a shared drive, it's easier to just see it in action, so next, you're going to enable mod_dav, which ships with Apache, and test it out. To start, as with other modules, check to see if mod_dav is already statically compiled into Apache, or existing as a loadable module:

/path/to/httpd -l
ls /path/to/apache/modules

As you might have guessed, if you don't see mod_dav.c in the httpd -l output, or mod_dav.so in the file list, you'll need to build it yourself with the Apache httpd source code. To add mod_dav statically into the Apache binary, make sure both --enable-dav and --enable-dav-fs exist in the configure command:

./configure \
--enable-dav \
--enable-dav-fs \
# ...and any other configure settings you use

To build mod_dav as a shared object, just add =shared to the end of both DAV-related lines:

./configure \
--enable-dav=shared \
--enable-dav-fs=shared \
# ...and any other configure settings you use

Then build and install the new ...

Get Professional LAMP: Linux®, Apache, MySQL®, and PHP5 Web Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.