How to Set Up WebDAV with Apache2 on Mandriva 2010.1 Spring

This tutorial will describe how to create WebDAV with Apache2 on a Madnriva 2010.1 Spring server. WebDAV is Web-based Distributed Authoring and Versioning. It can be used as extensions to the HTTP protocol so that the users can edit files without any interruption on the Apache server. In addition, they don’t have to be downloaded/uploaded through FTP. Certainly, we can use WebDAV for uploading and downloading files.

In this tutorial, Mandriva 2010.1 Spring server is used along with the IP address 192.168.0.100, so if you’re on a similar task and want to know how exactly to do this, make sure you replace the IP with yours.

Instructions

  • 1

    Installing WebDAV

    First of all, we need to update our package database:

    urpmi.update –a

    Afterwards, you have to install Apache and the Apache WebDAV module:

    urpmi apache apache-mod_dav

    Now open /etc/httpd/conf/httpd.conf and uncomment the following three lines in the LastModule section.

    Note: You have to delete the following string in the last part of these lines, if not than Apache might give a syntax error.

    vi /etc/httpd/conf/httpd.conf

    [...]

    LoadModule dav_module modules/mod_dav.so

    [...]

    LoadModule dav_fs_module modules/mod_dav_fs.so

    LoadModule dav_lock_module modules/mod_dav_lock.so

    [...]

    Now, restart Apache:

    /etc/init.d/httpd restart

  • 2

    Creating a Virtual Host

    Next is to set up a default Apache vhost. Set it up in the directory /var/www/web1/web. In order to do this, you have to include a default vhost at the end of /ect/httpd/conf/httpd.conf. In case you already have a vhost for which you want to start WebDAV, then adjust this guideline according to the required situation.

    Initially, we set up the directory /var/www/web1/web and then create the Apache user and group the head of that director:

    mkdir -p /var/www/web1/web
    chown apache:apache /var/www/web1/web

    Afterwards, include the new vhost at the end of /etc/httpd/conf/httpd.conf:

    vi /etc/httpd/conf/httpd.conf

    [...]

    NameVirtualHost *:80

    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/web1/web/

    Options Indexes MultiViews

    AllowOverride None

    Order allow,deny

    allow from all

    Then reload Apache:

    /etc/init.d/httpd reload

  • 3

    Configure the Virtual Host for WebDAV

    Now, make the WebDAV password file /var/www/web1/passwd.dav along with the user test (the –c switch makes the file if it is not available):

    htpasswd -c /var/www/web1/passwd.dav test

    You will be asked to write password for the user test.

    In order to give access to only root and the members of the apache group, you have to alter the permissions of the /var/www/web1/passwd.dav file.

    chown root:apache /var/www/web1/passwd.dav
    chmod 640 /var/www/web1/passwd.dav

    After that, amend vhost at the end of /etc/httpd/conf/httpd.conf and include the following lines to it:

    vi /etc/httpd/conf/httpd.conf

    [...]

    Alias /webdav /var/www/web1/web

    DAV On

    AuthType Basic

    AuthName "webdav"

    AuthUserFile /var/www/web1/passwd.dav

    Require valid-user

    [...]

    The concluding vhost should appear like this:

    [...]

    NameVirtualHost *:80

    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/web1/web/

    Options Indexes MultiViews

    AllowOverride None

    Order allow,deny

    allow from all

    Alias /webdav /var/www/web1/web

    DAV On

    AuthType Basic

    AuthName "webdav"

    AuthUserFile /var/www/web1/passwd.dav

    Require valid-user

    Now, you have to reload Apache afterwards:

    /etc/init.d/httpd reload

  • 4

    Testing WebDAV

    Install cadaver which is a command-line WebDAV client:

    urpmi cadaver

    If you want to test whether WebDAV works or not, write:

    cadaver http://localhost/webdav/

    Now you are asked to type in the user name. Write test in the user name and then the password for the user test. If it is ok, then it means you are permitted the access and WebDAV is working fine. Write quit to exit the WebDAV shell:

    [root@server1 administrator]# cadaver http://localhost/webdav/
    Authentication required for webdav on server `localhost':
    Username: test
    Password:
    dav:/webdav/> quit
    Connection to `localhost' closed.
    [root@server1 administrator]#

Leave a Reply

Your email address will not be published. Required fields are marked *


6 − four =