gpt4 book ai didi

apache - 如何在 Apache 2.4 中使用 DAV 和 DirectoryIndex?

转载 作者:行者123 更新时间:2023-12-02 08:40:43 24 4
gpt4 key购买 nike

在我的 apache 配置中,我有一个虚拟主机配置如下:

Alias /mediamanager /storage/files/mediamanager
<Directory /storage/files/mediamanager>
DirectoryIndex /mediaManagerIndex.php
DAV On
# ... And some authentication directives ... #
</Directory>

这个想法是,某人可以通过 WebDAV 客户端和简单的 Web 浏览器访问文件,在这种情况下,PHP 脚本会生成一些漂亮的目录 View 。

这在 Apache 2.2 中运行得很好,但最近我升级到 Apache 2.4,现在它坏了。我高度怀疑我患有this bug它已经有 2 年历史了,而且还没有修复的迹象。建议添加的解决方法:

<Limit PROPFIND>
DirectoryIndex never-encounterable-file-name.html
</Limit>

对我不起作用。可能是因为我仍然想要一个目录索引。如果我删除我的 DirectoryIndex WebDAV 再次工作(此目录中不存在 index.html 或类似文件),但当然我失去了使用 PHP 文件作为目录索引的能力。我尝试在 <Limit GET> 中指定我的 DirectoryIndex但这没有效果。

有没有办法让 DAV 和 DirectoryIndex 在 Debian 上的 Apache 2.4 中同时工作(如果可能的话,无需更改源代码和重新编译)?

最佳答案

为了解决此问题,请禁用 WebDAV 站点的目录索引。

在您的sites-available/site.conf 文件中添加DirectoryIndex disabled<Directory>声明,如下所示:

    <Directory /path/to/my/webdav/dir>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted

DirectoryIndex disabled
</Directory>

然后只需重新加载 Apache,您将不再遇到该问题:

sudo service apache2 reload

关于apache - 如何在 Apache 2.4 中使用 DAV 和 DirectoryIndex?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30916906/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com