Install apache 2 and enable webdav in debian
Install apache2 using the following comamnd
#aptitude install apache2
Enable webdav modules using the following commands
#a2enmod dav_fs
#a2enmod dav
Restart Apache web server using the following command
#/etc/init.d/apache2 restart
Create Virtualhost in apache
Now you need to create a default apache vhost in the directory /var/www/webdav.Now you need to modify default apach cofiguration file located at /etc/apache2/sites-available/default
You need to create /var/www/webdav directory and make www-data use the owner of the directory.
#mkdir /var/www/webdav
#chown www-data:www-data /var/www/webdav
Now you need to make a backup of default apache server config file
cp /etc/apache2/sites-available/default /etc/apache2/sites-available/default.back
Now you need to edit the /etc/apache2/sites-available/default file
#vi /etc/apache2/sites-available/default
add the following lines
NameVirtualHost *
<VirtualHost *>
ServerAdmin root@localhost
DocumentRoot /var/www/webdav/
<Directory /var/www/webdav/>
Options Indexes MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Restart Apache web server using the following command
#/etc/init.d/apache2 restart
Configure The Virtual Host For WebDAV
If you don't want to use password authentication you don't have to use the htpasswd steps this is very useful when you are using ip phone configuration for backup.
Now we create the WebDAV password file /var/www/webdav/passwd.dav with the user test (the -c switch creates the file if it does not exist)
#htpasswd -c /var/www/webdav/passwd.dav admin
You will be asked to type in a password for the user admin.
Now we change the permissions of the /var/www/webdav/passwd.dav file so that only root and the members of the www-data group can access it:
#chown root:www-data /var/www/webdav/passwd.dav
#chmod 640 /var/www/webdav/passwd.dav
Now we modify our vhost in /etc/apache2/sites-available/default and add the following lines to it
#vi /etc/apache2/sites-available/default
add the following lines to
Alias /share /var/www/webdav
<Location /share>
DAV On
AuthType Basic
AuthName "webdav"
AuthUserFile /var/www/webdav/passwd.dav
Require valid-user
</Location>
Restart Apache web server using the following command
#/etc/init.d/apache2 restart
Test your Configuration
First you need to install cadaver, a command-line WebDAV client using the following command
#apt-get install cadaver
To test if WebDAV works, type the following comamnd from the terminal
cadaver http://localhost/share/
You should be prompted for a user name. Type in admin and then the password for the user admin. If all goes well, you should be granted access which means WebDAV is working fine. Type quit to leave the WebDAV shell:
# cadaver http://localhost/share/
Authentication required for admin on server `localhost':
Username: admin
Password:
dav:/share/> quit
Connection to `localhost' closed.
Incoming search terms:
-
Jeff
-
http://www.debianadmin.com Anonymous Coward
-
Ryan
-
http://blog.helar.nl Ferdi Vriezen
-
http://www.capemaster.net capemaster
-
http://www.alphadatainternational.com/ Keshavaya
-
Tim5365
