var/davlock为ServerRoot下的子目录,并且需要chown apache.apache
ServerRoot/user/.htpasswd采用Basic鉴权方式
ServerRoot/user/password采用Digest鉴权方式
htpasswd -cm /usr/local/svn/svn-auth-file user1
htdigest -c ..... realm user1
# Load config files in the "/etc/httpd/conf.d" directory, if any.
IncludeOptional conf.d/*.conf
DavLockDB "var/davlock"
Alias /webdav /home/yhhan/webdav
<location /webdav>
Dav On
Order Allow,Deny
Allow from all
AuthType Digest
AuthName user
AuthUserFile /etc/httpd/user/password
<LimitExcept OPTIONS>
require user test
</LimitExcept>
</location>
Alias /webdav2 /home/yhhan/webdav
<directory /home/yhhan/webdav>
Dav On
# Require all granted
Order Allow,Deny
Allow from all
AuthType Basic
AuthName user
AuthUserFile /etc/httpd/user/.htpasswd
<LimitExcept OPTIONS>
require user test
</LimitExcept>
</directory>
以下方法能成功上传二进制文件:
[root@han ~]# curl --user "test:123456" --request PUT http://192.168.130.57/webdav2/otp-19.3.tar.gz --data-binary @otp-19.3.tar.gz
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>201 Created</title>
</head><body>
<h1>Created</h1>
<p>Resource /webdav2/otp-19.3.tar.gz has been created.</p>
</body></html>
[root@han ~]# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built: Nov 16 2020 16:18:20
[root@han ~]# httpd -V
Server version: Apache/2.4.6 (CentOS)
Server built: Nov 16 2020 16:18:20
Server's Module Magic Number: 20120211:24
Server loaded: APR 1.4.8, APR-UTIL 1.5.2
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture: 64-bit
Server MPM: prefork
threaded: no
forked: yes (variable process count)
Server compiled with....
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT="/etc/httpd"
-D SUEXEC_BIN="/usr/sbin/suexec"
-D DEFAULT_PIDLOG="/run/httpd/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"
[root@han ~]#
主要问题在于目录以及文件的权限。
DavLockDB "var/davlock" 必须是apache.apache