Gallery:模块:webdav:管理(admin)

来自站长百科
Firebrance讨论 | 贡献2008年11月6日 (四) 16:00的版本
跳转至: 导航、​ 搜索

该文档用于指导Gallery管理员进行WebDAV模块的配置及释疑。

如果你在查找有关WebDAV客户端的指导信息或开发方面资料的话,请参见:

配置

Gallery中各相册的WebDAV URL显示在WebDAV URL区块中。在站点管理(Site Admin)中,从管理选项(Admin Options)下选取外观主题(Themes)

你还可以使用Mount with WebDAV项目链接进行自动连接。

Zeroconf

Lennart Poettering的Apache mod_dnssd可用来发布Gallery和具有multicast DNS / Zeroconf / DNSSD / Rendezvous / Bonjour Gallery WebDAV连接: http://0pointer.de/lennart/projects/mod_dnssd/ http://packages.debian.org/libapache2-mod-dnssd

向你的Apache config添加如下语句:

<IfModule mod_dnssd.c>
  <Location /gallery2>
    DNSSDServiceName "Gallery"
  </Location>

  <Location /gallery2/w>
    DNSSDServiceName "Gallery"
    DNSSDServiceTypes _webdav._tcp
  </Location>
</IfModule>

之后Gallery会出现在Safari的Bonjour菜单中,Mac OS X "连接到服务器…"对话框中,以及Gnome的服务搜寻小程序中。

疑难解答

PHP没有XML支持

更多有关PHP XML支持的信息。

WebDAV请求未被处理

你的web服务器无法将WebDAV HTTP请求方法之一传至Gallery:

  • PROPFIND
  • PROPPATCH
  • MKCOL
  • LOCK
  • UNLOCK

如果你的网站是运行于Apache服务器上的话,请确保mod_dav对你的网站禁用了。参见:mod_dav

HTTP认证模块被禁用

更多有关HTTP认证模块的信息。

mod_dav

mod_dav 不是必须的。Dav 必须被禁用(从你的httpd.conf 中移除Dav On)。

'连接至WebDAV'规则被禁用

大多数WebDAV客户端不支持查询字串。'连接至WebDAV' URL重写规则生成不带查询字串的短URL。

DAV头缺失

WebDAV spec,RFC 2518,约定在所有OPTIONS应答中返回DAV头:

此头表明源支持DAV计划和协议。所有DAV相容的源必须在所有OPTIONS应答中返回DAV头。

WebDAV模块会在所有应答中返回DAV头,但某些服务器配置无法向脚本传输OPTIONS请求,如Apache不会向CGI脚本传输OPTIONS请求:http://issues.apache.org/bugzilla/show_bug.cgi?id=37982

或者我们可以使用Apache的mod_headers和mod_rewrite来设定DAV头。 http://httpd.apache.org/docs/mod/mod_headers.html http://httpd.apache.org/docs/rewrite/

mod_headers指令位于modules/webdav/data/options/.htaccess中。'OPTIONS Requests'重写规则将OPTIONS请求重新导向至该目录。

缺失DAV头的备用URL

如果你在使用Apache,就应当检查一下mod_headers是否被启用了。

URL重写模块被禁用

URL重写模块为OPTIONS请求自动进行重新导向,我们就可以设定DAV头了,并生成不具查询字串的短URL。

较差URL重写配置

WebDAV 'OPTIONS Requests'规则仅为Apache mod_rewrite和ISAPI_Rewrite解析器所支持。

'OPTIONS Requests' 规则被禁用

如果你使用Apache mod_rewrite,可以手动将下面内容加入Gallery的.htaccess文件中:

RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule .   /foo/gallery2/modules/webdav/data/options/   [QSA,L]

Native Windows WebDAV客户端无法连接到服务器

问题:

如果看起来是用户名/密码不被接受的话,你应当检查:

  • webserver是否运行的是Apache
  • Gallery是否在某个Apache别名文件夹中(mod_alias)

如果是这样的情况,Apache就不会重新导向example.com/gallery2 to example.com/gallery2/,而native Windows WebDAV客户端则会发出那样的请求。

解决方案:

在添加Gallery作为网络源,用户名/密码不被接受时进行取消即可,并点击向导中的继续按钮。一旦Gallery被添加为网络源,认证应会最终起效。

如果不行的话,比如我,那就尝试安装webdav客户端(如DataFreeway,接着在此客户端中安装你的连接。接着进行连接。之后再次用Native Windows WebDav客户端进行尝试... 这样应该就可以了。

mod_security和Apache相关注释

Tested under Apache 2.2.4 and mod_security 1.9.4 with URL Rewrite & HTTP Auth modules/plugins enabled. Client used was Windows XP "My Network Places"

Let's say you have a global (outside of any <Directory> or <VirtualHost> container) mod_security filter that deny requests other than GET, HEAD, and POST and return a "404 - file not found" (status:404) response.

SecFilterSelective REQUEST_METHOD "!^(GET|HEAD|POST)$" "id:1001,deny,log,status:404"

To bypass the filter and only allow it on a specific directory, add the following to your Apache config:

<Directory /path/to/gallery2/>
Options FollowSymLinks -Indexes -Includes -IncludesNOEXEC -ExecCGI
AllowOverride Options FileInfo AuthConfig
....
SecFilterRemove 1001
SecFilterSelective REQUEST_METHOD "!^(GET|HEAD|POST|PROPFIND|PROPPATCH|MKCOL|LOCK|UNLOCK|MOVE|PUT|OPTIONS|DELETE|USERNAME)$"
</Directory>

In the example given, "1001" ("id:1001,deny,log,status:404") is the ruleset ID assigned to the global filter. "SecFilterRemove 1001" disables the filter.

Save your changes, then restart Apache > login to Site Admin > Plugins > uninstall and reinstall the following plugin in the exact order:

- URL Rewrite, HTTP Auth then WebDav

start the Windows Explorer > browse into My Network Places > Add Network Place and paste the URL address provided by G2 to mount

MS Internet Explorer <-> Apache WebDav的简单备忘单

如前文可能会有些简单和杂乱...:

  • 启用Gallery2的URL重写插件/Apache的mod_rewrite(/gallery2/ base目录下的.htaccess chmod为666)
  • 确保在Apache中禁用了mod_dav和mod_dav_fs(grep那些Apache模块的phpinfo()输出)
  • 启用Gallery2的HTTP认证插件(Auth Plugin)
  • 启用Gallery2外观主题中的WebDav内容区块(我用在相册页面上了)
  • 使用IE登入Gallery2
  • 浏览到你想编辑的地方
  • 点击'Click here'来打开WebDav连接

警告 "维护模式"必须被禁用!!因为不兼容!(重写规则的某些原因所致)