为了让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:
2.Remove comment out:
3.open http-dav.conf
4.创建账户
5. http-dav解释
Dav on 启用WebDav服务
Order Allow,Deny
Allow from all 先检查禁止设定,没有禁止的全部允许
AuthType Digest 使用Digest授权方式
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 "/usr/local/apache/var/DavLock"
- DavLockDB "/tmp/DavLock"
-
- Alias /webdav "/var/www/html"
- <Directory "/var/www/html">
- Dav On
- Order Allow,Deny
- Allow from all
- AuthType Digest
- AuthName DAV-upload
- # You can use the htdigest program to create the password database:
- # htdigest -c "/usr/local/apache/user.passwd" DAV-upload admin
- AuthUserFile "/usr/local/apache/webdav.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 "/usr/local/apache/user.passwd" DAV-upload iptv
5. http-dav解释
Dav on 启用WebDav服务
Order Allow,Deny
Allow from all 先检查禁止设定,没有禁止的全部允许
AuthType Digest 使用Digest授权方式
AuthUserFile authentication的文件
LimitExcept 除了..以外都需要校验信息
6. troubleshooting
1. /log/error_log: The locks could not be queried for verification against a possible "If:" header. [500, #0]
/tmp/DavLock文件所在的用户/组和httpd.conf文件里的user/group不匹配
2. /log/error_log: Unable to PUT new contents for /webdav/content/temp1/20130809T032258-01-270133.ts. [403, #0]
httpd.conf文件里的user/group没有加进apache用户组