Apache WebDav服务

为了让Apache显示能像FTP server那样的文件列表,我们可以使用Apache的WebDav的服务。

WebDav(Web-based Distributed Authoring and Versioning)是一种基于HTTP1.1协议的通信协议,扩展了HTTP1.1,主要有GET(检索文档),PUT和POST(将文档提交到服务器),HEAD,OPTIONS和TRACE(主要由应用程序用来发现和跟踪服务器支持和网络行为),DELETE(销魂资源或集合)Mkcol(创建集合),PropFind和PropPatch(针对资源和集合检索和设置属性),Copy和Move(管理命名空间上下文中的资源和集合),Lock和Unlock(改写保护)。

WebDav请求的一般机构遵循HTTP格式,并且由一下三个组件构成:
1.方法,声明由客户端执行的方法
2.标头,描述有关如何完成此任何的指令。
3.主体(optional),定义用在该指令或者其他指令中的数据,用以描述如何完成此方法。

WebDav允许客户端进行下列操作:

处理服务器上 WebDAV 发布目录中的资源。使用此功能,其优点例如:
1.具有正确权限的用户可以在 WebDAV目录中复制和移动文件。
2.修改与某些资源相关联的属性。例如,用户可写入并检索文件的属性信息。
3.锁定并解锁资源以便多个用户可同时读取一个文件。但每次只能有一个人修改文件。
4.搜索 WebDAV 目录中的文件的内容和属性。

Apache支持WebDav服务,而且配置也很简单。
1.Enable module:

LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule dav_lock_module modules/mod_dav_lock.so


2.Remove comment out:
Include conf/extra/httpd-dav.conf


3.open http-dav.conf

#
# Distributed authoring and versioning (WebDAV)
#
# Required modules: mod_dav, mod_dav_fs, mod_setenvif, mod_alias
# mod_auth_digest, mod_authn_file
#

# The following example gives DAV write access to a directory called
# "uploads" under the ServerRoot directory.
#
# The User/Group specified in httpd.conf needs to have write permissions
# on the directory where the DavLockDB is placed and on any directory where
# "Dav On" is specified.

DavLockDB "C:/development/Apache Software Foundation/Apache2.2/var/DavLock"

Alias /uploads "C:/development/Apache Software Foundation/Apache2.2/uploads"

#CustomLog "C:/development/Apache Software Foundation/Apache2.2/logs/all-bw.log" IOFormat

<Directory "C:/development/Apache Software Foundation/Apache2.2/uploads">
Dav On

IndexOptions FancyIndexing VersionSort FoldersFirst NameWidth=*

Options Indexes MultiViews
#display the file list for webdav service
Order Allow,Deny
Allow from all

AuthType Digest
AuthName DAV-upload

# You can use the htdigest program to create the password database:
# htdigest -c "C:/development/Apache Software Foundation/Apache2.2/user.passwd" DAV-upload admin
AuthUserFile "C:/development/Apache Software Foundation/Apache2.2/user.passwd"
AuthDigestProvider file

# Allow universal read-access, but writes are restricted
# to the admin user.
<LimitExcept GET OPTIONS>
require user iptv
</LimitExcept>
</Directory>

#
# The following directives disable redirects on non-GET requests for
# a directory that does not include the trailing slash. This fixes a
# problem with several clients that do not appropriately handle
# redirects for folders with DAV methods.
#
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "MS FrontPage" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully
BrowserMatch "^gnome-vfs/1.0" redirect-carefully
BrowserMatch "^XML Spy" redirect-carefully
BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully



4.创建账户
htdigest -c "C:/development/Apache Software Foundation/Apache2.2/user.passwd" DAV-upload admin


5. http-dav解释
Dav on 启用WebDav服务
Options Indexes MultiViews 在web页面用显示文件列表
IndexOptions FancyIndexing VersionSort FoldersFirst NameWidth=*在文件列表中显示相关信息
Order Allow,Deny
Allow from all 先检查禁止设定,没有禁止的全部允许
AuthType Digest 使用Digest授权方式

AuthUserFile authentication的文件

LimitExcept 除了..以外都需要校验信息
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值