Tuesday, April 10, 2012

Configuring WebDav on IHS (CentOS)

1. What is WebDav ?

It is Web-based Distributed Authoring and Versioning, is basically a set of extensions to the HTTP that allows the users to edit, manage files on a remote server.

2. How to enable WebDav in IHS?

I will use IHS as HTTP server in my example. 
  • Enable DAV modules of IHS
Locate to the IHS configuration file, which is usually in /opt/IBM/HTTPServer/conf and use an editor to open the httpd.conf and uncomment these following lines:
...
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so
...
Then add this line to the end of the httpd.conf to load your configuration file which will be created in next step

Include /opt/IBM/HTTPServer/conf/webdav.conf
  • Configure the DAV
Next step is to create necessary directories and the configuration file mentioned above (webdav.conf)
Make webdav directory where will be the file storage:
#mkdir -p /home/ihs/webdav
Make directory to store the lock files created by the DAV module
#mkdir -p /opt/IBM/HTTPServer/var/DAVLock
Change the owner of the directories to the user nobody of group nobody as which the IHS instance runs
#chown nobody:nobody /home/ihs/webdav
# chown nobody:nobody /opt/IBM/HTTPServer/var/DAVLock

Put configuration content into webdav.conf, to be something like this:

Aias /webdav "/home/ihs/webdav"
Alias /webdav/ "/home/ihs/webdav"
<Directory /home/ihs/webdav>
                Dav On
                Options +Indexes
                IndexOptions FancyIndexing
                AddDefaultCharset UTF-8
                AuthType Basic
                AuthName "WebDav Server"
                AuthUserFile /etc/ihs/webdav.users.pwd
                <LimitExcept POST GET>
                        Require valid-user
                </LimitExcept>
                Order allow,deny
                Allow from all
</Directory>
  • Create DAV user(s) 
Make sure you have path to htpasswd added to the $PATH of the environment, before executing the command below, to create a user mym

# htpasswd -c /etc/ihs/webdav.users.pwd mym
New password:
Re-type new password:
Adding password for user mym
Restart your IHS.

# /opt/IBM/HTTPServer/bin/apachectl restart
 
Now you can use a WebDav client to connect to the server