You want to add or enable WebDAV capabilities to your server. WebDAV permits specific documents to be reliably and securely manipulated by remote users without the need for FTP, to perform such tasks as adding, deleting, or updating files.
If you're using Apache 2.0, mod_dav is automatically available, although you may need to enable it at compile time with enable-dav.
If you are using Apache 1.3, download and unpack the mod_dav source package from http://webdav.org/mod_dav/, and then:
% cd mod_dav-1.0.3-1.3.6 % ./configure --with- apxs=/usr/local/ apache/bin/apxs % make # make install
Restart the server, and be sure to read Recipe 6.18.
mod_dav is an encapsulated and well-behaved module that is easily built and added to an existing server. To test that it has been properly installed, you need to enable some location on the server for WebDAV management and verify access to that location with some WebDAV-capable tool. We recommend cadaver, which is an open source command-line WebDAV tool. (The URL for the cadaver tool is found at the end of this recipe.)
To enable your server for WebDAV operations, you need to add at least two directives to your httpd.conf file. The first identifies the location of the locking database used by mod_dav to keep WebDAV operations from interfering with each other; it needs to be in a directory that is writable by the server. For example:
# cd /usr/local/apache # mkdir var # chgrp nobody var # chmod g+w var
Now add the following line to your httpd.conf file, outside any containers:
<IfModule mod_dav.c> DAVLockDB var/DAVlock </IfModule>
Next, create a temporary directory for testing WebDAV functionality:
# cd /usr/local/apache # mkdir htdocs/dav-test # chgrp nobody htdocs/dav-test # chmod g+w htdocs/dav-test
Add a stanza to your httpd.conf file that will enable this directory for WebDAV operations:
<Directory "/usr/local/apache/htdocs/dav-test"> DAV On </Directory>
Now restart your server. It should be ready to handle WebDAV operations directed to the /dav-test local URI. To test it with the cadaver tool, try the following commands; your output should look very similar to that shown:
% cd /tmp % echo "Plain text" > dav-test.txt % cadaver dav:!> open http://localhost/dav-test Looking up hostname... Connecting to server... connected. dav:/dav-test/> put dav-test.txt Uploading dav-test.txt to '/dav-test/dav-test.txt': (reconnecting...done) Progress: [= == == == == == == == == == == == == == ==>] 100.0% of 11 bytes succeeded. dav:/dav-test/> propset dav-test.txt MyProp 1023 Setting property on 'dav-test.txt': (reconnecting...done) succeeded. dav:/dav-test/> propget dav-test.txt MyProp Fetching properties for 'dav-test.txt': Value of MyProp is: 1023 dav:/dav-test/> propdel dav-test.txt MyProp Deleting property on 'dav-test.txt': succeeded. dav:/dav-test/> close Connection to 'localhost' closed. dav:!> exit % rm dav-test.txt
Properties are attributes of a WebDAV resource. Some are managed by the system, such as the resource's size, but others can be arbitrary and added, changed, and removed by the user.
Once you have verified that mod_dav is working correctly, remove the htdocs/dav-test directory, and the corresponding <Directory> stanza in your httpd.conf file, and follow the guidelines in Recipe 6.18.