我正在尝试在我的 centos 8 上设置 webdav 服务器,但最后几个小时一直卡在一条"client denied by server configuration: /srv/webdav/fs"
消息中。我读过几个发生此错误的帖子,但没有一个能帮助我找出问题所在。
这是我的配置文件:
DavLockDB "/etc/httpd/var/davlock"
<VirtualHost *:443>
ServerName example.com
ServerAdmin example@mail
DocumentRoot /srv/webdav
ErrorLog /var/log/httpd/error.log
CustomLog /var/log/httpd/access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
Alias /fs /srv/webdav/fs
<Directory /fs>
AuthType "Basic"
AuthName "Password Manager"
AuthBasicProvider file
AuthUserFile "/etc/httpd/conf/dav_passwords"
Require valid-user
DAV On
Options Indexes
</Directory>
</VirtualHost>
我创建了一个用户sudo htpasswd -c /etc/httpd/conf/dav_passwords john
。
/srv/webdav
其所有者为 apache:apache。
非常感谢您的帮助。提前致谢!
编辑:
我将日志级别改为 trace3,并在错误文件中获得了一些更详细的日志。但我仍然看不出问题出在哪里:
[Thu May 13 08:11:02.888221 2021] [ssl:trace3] [pid 3464:tid 140514974116160] ssl_engine_init.c(607): Using OpenSSL/system default SSL/TLS protocols
[Thu May 13 08:11:02.888225 2021] [ssl:trace3] [pid 3464:tid 140514974116160] ssl_engine_init.c(628): Creating new SSL context (protocols: default)
[Thu May 13 08:11:02.888535 2021] [ssl:trace1] [pid 3464:tid 140514974116160] ssl_engine_init.c(972): Configuring permitted SSL ciphers [ALL:!COMPLEMENTOFDEFAULT:!eNULL:!aNULL:!eNULL:!EXP]
[Thu May 13 08:11:02.888590 2021] [ssl:debug] [pid 3464:tid 140514974116160] ssl_engine_init.c(520): AH01893: Configuring TLS extension handling
[Thu May 13 08:11:02.888795 2021] [ssl:warn] [pid 3464:tid 140514974116160] AH01906: example.com:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Thu May 13 08:11:02.888809 2021] [ssl:trace3] [pid 3464:tid 140514974116160] ssl_util_ssl.c(433): [example.com:443] modssl_X509_match_name: expecting name 'example.com', matched by ID 'example.com'
[Thu May 13 08:11:02.888840 2021] [ssl:debug] [pid 3464:tid 140514974116160] ssl_util_ssl.c(444): AH02412: [example.com:443] Cert matches for name 'example.com' [subject: emailAddress=example@mail,CN=example.com / issuer: emailAddress=example@mail,CN=example.com / serial: 7C1166CC353EC7F29C68B66269042224CEE41E67 / notbefore: May 12 08:52:52 2021 GMT / notafter: May 12 08:52:52 2022 GMT]
[Thu May 13 08:11:02.888846 2021] [ssl:info] [pid 3464:tid 140514974116160] AH02568: Certificate and private key example.com:443:0 configured from /etc/ssl/certs/apache-selfsigned.crt and /etc/ssl/private/apache-selfsigned.key
答案1
问题在于:
Alias /fs /srv/webdav/fs
<Directory /fs>
...
</Directory>
里面的指令<Directory /fs>
不适用,因为目录不是/fs
,而是/srv/webdav/fs
。尝试<Directory /srv/webdav/fs>
。
答案2
好的,所以我解决了这个问题。我完全重新安装了 httpd 并再次创建了文件(具有适当的权限和所有权)。然后我没有DavLockDB "/etc/httpd/var/davlock"
在 webdav.conf 文件中指定,因此它默认/var/lib/dav/lockdb
为根据默认的 Apache 配置。(我不知道为什么会有所不同......)最后我需要更改语境我的 webdav 目录chcon -R -t httpd_sys_content_rw_t /path/to/dir
现在可以使用了。再次感谢 Andrew 的帮助!