Apache as a File Repository

Posted by Anandhan Subbiah on May 14, 2007 in Programming Concepts, Technical ArticlesNo comments

WebDAV, which stands for Web-based Distributed Authoring and Versioning enables Apache to act as a network drive . It uses HTTP as the protocol instead of TCP/IP or port like SMB and NFS.

How can we do this ?

  • mod_dav which ships with Apache has to be enabled. You should be able to see the library in the modules directory.
  • If it is not available then you may have to build it . The library can be downloaded at  mod_dav  .After you install them using make add the following lines to httpd.conf
"LoadModule dav_module
modules/mod_dav.so LoadModule dav_fs_module modules/mod_dav_fs.so"
  • A new directory has to be created to store the files. It is a good practise to create the folder in your SSL enabled web root.

                mkdir  /wwwssl/dav

  • To enable basic authentication a htpasswd file has to be created

               mkdir testauth 

              htpasswd -c /testauth/dav.htpasswd testdav

  • Create a .htaccess file under /wwwssl/dav . The file should have the following entry

            AuthName “DAV Test”
            AuthType Basic
            AuthUserFile “/davauth/dav.htpasswd”
            require valid-user

  • make the following entry in httpd.conf

               < Directory “/wwwssl/dav”/>
                  AllowOverride AuthConfig
                  Dav On
               < Directory />        

Restart apache and ”somedomain.com/dav” would be the path to your repository (replace somedomain.com with your site url).To use the capabilities of your WebDAV URL, you’ll need to use software that is WebDAV-enabled. Apache has a open source project called Slides which is a CMS tool built over WEBDav

Leave a comment