debian上的webdav服务

网上看了debian 5.0 安装apache 的webdav服务,我用其方法在debian 6.0上实现webdav,将其方法拷贝过来。

抄自:http://www.debianadmin.com/webdav-with-apache2-on-debian-5-0-lenny.html


Web-based Distributed Authoring and Versioning, or WebDAV, is a set of extensions to the Hypertext Transfer Protocol(HTTP) that allows users to edit and manage files collaboratively on remote World Wide Web servers.


Installing WebDAV in debian

First install apache using the following command

#aptitude install apache2

Enable the WebDAV modules using the following commands

#a2enmod dav_fs

#a2enmod dav

Restart Apache server

#/etc/init.d/apache2 restart

Creating A Virtual Host in Apache

Now create a default Apache vhost in the directory /var/www/webdav. We will modify the default Apache vhost configuration in /etc/apache2/sites-available/default. If you already have a vhost for which you’d like to enable WebDAV, you must adjust this tutorial to your situation.

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

#mkdir -p /var/www/webdav

#chown www-data /var/www/webdav

Then we back up the default Apache vhost configuration (/etc/apache2/sites-available/default) and create our own one

#mv /etc/apache2/sites-available/default /etc/apache2/sites-available/default.original

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

NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/webdav
<Directory /var/www/webdav>
Options Indexes MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>

Restart Apache server

#/etc/init.d/apache2 reload

Configure The Virtual Host For WebDAV

Now we create the WebDAV password file /var/www/webdav/passwd.dav with the user test

#htpasswd -c /var/www/webdav/passwd.dav testnew

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

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

Alias /webdav /var/www/webdav

<Location /webdav>
DAV On
AuthType Basic
AuthName “webdav”
AuthUserFile /var/www/webdav/passwd.dav
Require valid-user
</Location>

The Alias directive makes (together with <Location>) that when you call /webdav, WebDAV is invoked, but you can still access the whole document root of the vhost.

Reload Apache server

#/etc/init.d/apache2 reload

Testing your WebDAV

We will now install cadaver,cadaver is a command-line WebDAV client for Unix. It supports file upload, download, on-screen display, namespace operations (move/copy), collection creation and deletion, and locking operations.

#apt-get install cadaver

To test if WebDAV works use the following command

#cadaver http://localhost/webdav/

You should be prompted for a user name. Type in test and then the password for the user testnew. If all goes well, you should be granted access which means WebDAV is working ok. Type quit to leave the WebDAV shell.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值