Apache2.4.6 Webdav 不适用于 Centos7

问题描述

我已经在 Centos7 官方安装了 Apache 2.4.6。 httpd.conf 未更改为认值。 使用以下内容配置 webdav.conf:

DavLockDB /var/www/html/DavLock
<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/webdav/
    ErrorLog /var/log/httpd/error.log
    CustomLog /var/log/httpd/access.log combined
    Alias /webdav /var/www/html/webdav
    <Directory /var/www/html/webdav>
        DAV On
    </Directory>
</VirtualHost>

webdav 目录有 755 个权限。未创建 DavLock。

我不断收到此错误,但不确定可能是什么原因。尝试了很多事情都没有成功: [Fri Jan 29 11:41:17.027110 2021] [dav:error] [pid 15068] [client xxx.xxx.xxx.xxx:53946] 无法针对可能的“If:”标头查询锁以进行验证。 [500,#0] [Fri Jan 29 11:41:17.027134 2021] [dav:error] [pid 15068] [client xxx.xxx.xxx.xxx:53946] 无法打开锁数据库。 [500,#400] [Fri Jan 29 11:41:17.027137 2021] [dav:error] [pid 15068] (13)Permission denied: [client xxx.xxx.xxx.xxx:53946] 无法打开属性数据库。 [500,#1]

欢迎任何想法

解决方法

现在开始工作了。 /var/www/ 下的所有文件/文件夹都被 chown 给 apache

moved DavLock to here: /var/lib/dav/

并在 httpd.conf 下添加这一行:

<IfModule mod_dav_fs.c>
    # Location of the WebDAV lock database.
    DAVLockDB /var/lib/dav/DavLock
</IfModule>

此时,我收到 403 错误。通过执行以下操作解决:

chcon -R -t httpd_sys_content_rw_t /var/www/html/webdav/