1、首先启用apache的webadv的module
cd /etc/apache2/mods-enabled
sudo ln -s ../mods-available/dav.load dav.load
sudo ln -s ../mods-available/dav_fs.conf dav_fs.conf
sudo ln -s ../mods-available/dav_fs.load dav_fs.load
sudo ln -s ../mods-available/dav_lock.load dav_lock.load
2、配置 dav_fs.conf
sudo vim dav_fs.conf
DAVLockDB ${APACHE_LOCK_DIR}/DAVLock
Alias /webdav /media/usb0/webdav
<Directory "/media/usb0/webdav">
DAV On
AuthType Basic
AuthName "webdav"
AuthUserFile /etc/webdav.passwd
Require valid-user
Options Indexes FollowSymLinks
</Directory>
我这里启用的密码访问,可以用以下方式生成密码
sudo htpasswd -c /etc/webdav.passwd webdav
3、修改权限
sudo chown -R www-data:www-data /media/usb0/webdav/
4、重启apache
sudo /etc/init.d/apache2 restart
来源:http://wjjchen.blog.163.com/blog/static/16287222013423101753405/