Google Plus

Setup WebDAV With Apache2 On ubuntu 9.0.4

Written by Mel Kham on . Posted in Linux tutorials

Web-based Distributed Authoring and Versioning, or WebDAV, WebDAV is a protocol that allows for convenient mounting of a remote server on your desktop for easy file access. Once setup, using it is as simple as any other drag and drop navigation on your desktop.

Before to start please change the IP 192.168.1.102 in this tutorial with your own IP.

 

1 Installing WebDAV

If Apache is not already installed, install with:

sudo apt-get install apache2

Afterwards, enable the WebDAV modules:

a2enmod dav_fs
a2enmod dav

Reload Apache:

sudo /etc/init.d/apache2 force-reload


2- Creating A Virtual Host

I will now create a default Apache vhost in the directory /var/www/html/web

First, we create the directory /var/www/html/web and make the Apache user (www-data) the owner of that directory:

sudo mkdir -p /var/www/html/web
sudo  chown www-data /var/www/html/web

make a nackup of the default Apache vhost configuration (/etc/apache2/sites-available/default) and create our own one:

sudo mv /etc/apache2/sites-available/default /etc/apache2/sites-available/default_backup
sudo vi /etc/apache2/sites-available/default
NameVirtualHost *
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/web/
Options Indexes MultiViews
AllowOverride None
Order allow,deny
allow from all

Then reload Apache:

sudo /etc/init.d/apache2 reload


3- Configure Virtual Host For WebDAV

Now we create the WebDAV password file /var/www/web1/passwd.dav with the user user1

sudo htpasswd -c /var/www/html/passwd.dav user1

You will be asked to type in a password for the user user1.

sudo htpasswd /var/www/html/passwd.dav 192.168.1.102user1

(We must use a second backslash here in the user name to escape the first one!)

Now we change the permissions of the /var/www/html/passwd.dav file so that only root and the members of the www-data group can access it:

sudo chown root:www-data /var/www/html/passwd.dav
 sudo chmod 640 /var/www/html/passwd.dav

Now we modify our vhost in /etc/apache2/sites-available/default and add the following lines to it:

sudo vi /etc/apache2/sites-available/default

Now we have to make a Alias /webdav

[...]
Alias /webdav /var/www/html/web
DAV On
AuthType Basic
AuthName "webdav"
AuthUserFile /var/www/html/passwd.dav
Require valid-user
[...]

The final vhost should look like this:

NameVirtualHost *
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/web/
Options Indexes MultiViews
AllowOverride None
Order allow,deny
allow from all
Alias /webdav /var/www/html/web
DAV On
AuthType Basic
AuthName "webdav"
AuthUserFile /var/www/html/passwd.dav
Require valid-user

Reload Apache afterwards:

sudo /etc/init.d/apache2 reload


4- Testing WebDAV

We will now install cadaver, a command-line WebDAV client:

sudo apt-get install cadaver

To test if WebDAV works, type:

cadaver http://localhost/webdav/

then inout the login and password

test1.unixmen1:~# cadaver http://localhost/webdav/
 Authentication required for test on server `localhost':
Username: test
Password:
dav:/webdav/> quit
Connection to `localhost' closed.
test1.unixmen:~#

Now go to windows start-run and type ipwebdav or add this directory with add network place .

For any question please; post it in the forum

For questions please refer to our Q/A forum at : http://ask.unixmen.com

Mel Kham

Founder of Unixmen, Living in Amsterdam. Am working in my free time to help people to understand the Opensource and to explain them in easy way how to make the fist steps to the the light. Working day and night with my Co-founder Zinovsky to keep this website live even with less resources.
  • Umz

    Ive created a user but everytime i try access with cadaver i keep getting

    Could not open collection:
    Could not authenticate to server: rejected Basic challenge

    Ive changed user names and passwords many times but it keeps saying that my authentication is incorrect.

Like us on Facebook

This week Top Posts

Write for us

Recent Comments

LinuxSytesNet

|

sabayon facebook group is not maintained by him but a French guy. Go back to your zorin os.

Nidal Samara

|

How do I save the entier URL?
for example: page.asp?page=12,
After adding the IfModule in .htaccess I see the correct 404, but 404 url is not shoing the query string , only page.asp

abhishek Bagusetty

|

Hey Mel,

First of all, its good that you have figured a way to block torrents using iptables. I am new to networking and would like to do couple of things.

1) Monitor the network activity in the home network

2) Block all the torrents from downloading.

Is there a tool or a way in linux which could give me some solutions to meet the above mentioned cases. I dont want to use any commercial programs as I am more towards OpenSource. It would be greatful if you could offer me some help.

Thanks,

Abhi

Abhishek

Department of Chemical Engineering

The University of Utah

Ernesto Gutierrez

|

Mel, I’ve been unsuccessful at installing citrix receiver on a 64 bit fedora install.
Eventhough I am following your instructions to the T.

Can you provide guidance via email?

SK

|

Yes you can. It should work.

 
IDG Tech Network
Copyright © 2008-2013 Unixmen.com .
Maintained by Anblik .