How to setup Web Dav Apache easily

This is a quick tutorial about Web Dav which allow you to upload files into http protocol. May be it's not secure. I just want to make it simple and easy to follow.

Install required packages

Including for testing

sudo apt-get install apache2 cadaver

Activates Apache modules for Web Dav

sudo a2enmod dav_lock dav dav_fs

Prepare Web Dav directory

This is where you put your files

sudo mkdir -p /home/webdav/data
sudo chown www-data:www-data /home/webdav/data
sudo chmod u+rwx /home/webdav/data

Create passwords

sudo htpasswd -c /home/webdav/passwd michsan
sudo chown www-data:www-data /home/webdav/passwd
sudo chmod u+r,og-rwx /home/webdav/passwd

Prepare lock file

sudo touch /home/webdav/lock
sudo chown www-data:www-data /home/webdav
sudo chown www-data:www-data /home/webdav/lock
sudo chmod u+rw,og-rwx /home/webdav

Add configuration

You must add the following lines into /etc/apache2/sites-enabled/default

    Alias /webdav/ "/home/webdav/data/"
    <Directory "/home/webdav/data/">
       DAV On
       AuthName "WebDAV Login"
       AuthType Basic
       AuthUserFile /home/webdav/passwd
       Require valid-user
       DavMinTimeout 600
       <LimitExcept GET HEAD OPTIONS POST>
          Require valid-user
       </LimitExcept>
       Order allow,deny
       Allow from all
    </Directory>

    DavLockDB /home/webdav/lock

Now restart the apache

sudo apache2ctl restart

Test you Web Dav

If you have Konqueror (like me), just type (change ; into :) : webdav;//localhost/webdav. Try put some files there once you've been authenticated. Or you can use cadaver.

cadaver http;//localhost/webdav
put /home/ichsan/myFavSong.mp3
ls

Viola! It should work now. Happy Web Dav-ing!

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <img> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <h2> <h3> <pre>
  • Lines and paragraphs break automatically.
  • Syntax highlight code surrounded by the {syntaxhighlighter OPTIONS}...{/syntaxhighlighter} tags.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.