状況
SSLを有効にしたNGINXベースのWebDAVサーバーをセットアップしました。Windowsエクスプローラーからサーバーに接続しようとしたところ、ファイルをアップロードするまではすべて正常に動作しました。Windowsエクスプローラーは次のように言いました。宛先にはすでに「[ファイル名]」という名前のファイルがあります、クリックすると交換する、Windowsがプロンプトを表示ソースファイルまたはディスクから読み取れません。
失敗後、Windows エクスプローラーを更新したところ、Webdav サーバーにまったく同じ [ファイル名] の新しいファイルが作成され、0 KB (データなし) であることがわかりました。WinSCP
と Cyberduck で接続してみましたが、すべて正常に動作し、アップロード/ダウンロードに問題はありませんでした。
ちょっとした回避策
NGINX 設定を確認しましたが、問題は見つかりませんでした。これが私の NGINX 設定です。
nginx.conf
worker_processes auto;
error_log /var/log/nginx/error.log;
load_module /usr/lib/nginx/modules/ngx_http_dav_ext_module.so;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 4096;
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /usr/share/nginx/html;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}
ウェブダブ
server {
listen 6999 ssl http2;
server_name my.domain;
ssl_certificate /path/to/fullchain.pem;
ssl_certificate_key /path/to/privkey.pem;
ssl_session_timeout 5m;
ssl_protocols TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
ssl_session_cache builtin:1000 shared:SSL:10m;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
client_header_timeout 120s;
client_body_timeout 120s;
client_max_body_size 100m;
location / {
# Windows Explorer Workaround
#if (-d $request_filename) { rewrite ^(.*[^/])$ $1/ break; }
#if ($request_method = MKCOL) { rewrite ^(.*[^/])$ $1/ break; }
root /path/to/webdav/folder;
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS LOCK UNLOCK;
dav_access user:rw group:rw all:rw;
client_max_body_size 0;
create_full_put_path on;
client_body_temp_path /srv/client-temp;
autoindex on;
auth_basic on;
auth_basic_user_file /etc/nginx/users.list;
allow all;
}
}
グーグルで調べてみたらこれを見つけた記事しかし、役に立ちませんでした。
また、WebDAV フォルダーの権限を 777 に設定し、所有者を nginx に変更してみましたが、役に立ちませんでした。
NGINX アクセス ログを確認したところ、次のことがわかりました。
xxx.xxx.xxx.xxx - username [29/Sep/2019:15:20:06 +0800] "PUT /config HTTP/2.0" 201 0 "-" "Microsoft-WebDAV-MiniRedir/10.0.18362" "-"
xxx.xxx.xxx.xxx - username [29/Sep/2019:15:20:06 +0800] "LOCK /config HTTP/2.0" 405 157 "-" "Microsoft-WebDAV-MiniRedir/10.0.18362" "-"
xxx.xxx.xxx.xxx - username [29/Sep/2019:15:20:06 +0800] "PROPFIND /config HTTP/2.0" 207 463 "-" "Microsoft-WebDAV-MiniRedir/10.0.18362" "-"
xxx.xxx.xxx.xxx - username [29/Sep/2019:15:20:07 +0800] "PROPFIND /config HTTP/2.0" 207 463 "-" "Microsoft-WebDAV-MiniRedir/10.0.18362" "-"
xxx.xxx.xxx.xxx - username [29/Sep/2019:15:20:07 +0800] "PROPFIND /config HTTP/2.0" 207 463 "-" "Microsoft-WebDAV-MiniRedir/10.0.18362" "-"
xxx.xxx.xxx.xxx - username [29/Sep/2019:15:20:07 +0800] "PROPFIND /Thumbs.db HTTP/2.0" 404 153 "-" "Microsoft-WebDAV-MiniRedir/10.0.18362" "-"
xxx.xxx.xxx.xxx - username [29/Sep/2019:15:20:07 +0800] "PROPFIND /Documents/somefile HTTP/2.0" 207 511 "-" "Microsoft-WebDAV-MiniRedir/10.0.18362" "-"
xxx.xxx.xxx.xxx - username [29/Sep/2019:15:21:33 +0800] "PROPFIND /macOS%20Files HTTP/2.0" 207 448 "-" "Microsoft-WebDAV-MiniRedir/10.0.18362" "-"
xxx.xxx.xxx.xxx - username [29/Sep/2019:15:21:33 +0800] "PROPFIND /Documents/somefile HTTP/2.0" 207 511 "-" "Microsoft-WebDAV-MiniRedir/10.0.18362" "-"
xxx.xxx.xxx.xxx - username [29/Sep/2019:15:21:33 +0800] "PROPFIND /config HTTP/2.0" 207 463 "-" "Microsoft-WebDAV-MiniRedir/10.0.18362" "-"
xxx.xxx.xxx.xxx - username [29/Sep/2019:15:21:33 +0800] "PROPFIND /config%20(2) HTTP/2.0" 404 153 "-" "Microsoft-WebDAV-MiniRedir/10.0.18362" "-"
xxx.xxx.xxx.xxx - username [29/Sep/2019:15:21:33 +0800] "PROPFIND / HTTP/2.0" 207 424 "-" "Microsoft-WebDAV-MiniRedir/10.0.18362" "-"
xxx.xxx.xxx.xxx - username [29/Sep/2019:15:21:33 +0800] "LOCK /config HTTP/2.0" 405 157 "-" "Microsoft-WebDAV-MiniRedir/10.0.18362" "-"
xxx.xxx.xxx.xxx - username [29/Sep/2019:15:21:33 +0800] "PROPFIND /config HTTP/2.0" 207 463 "-" "Microsoft-WebDAV-MiniRedir/10.0.18362" "-"
xxx.xxx.xxx.xxx - username [29/Sep/2019:15:21:33 +0800] "LOCK /config HTTP/2.0" 405 157 "-" "Microsoft-WebDAV-MiniRedir/10.0.18362" "-"
xxx.xxx.xxx.xxx - username [29/Sep/2019:15:21:33 +0800] "PROPFIND /config HTTP/2.0" 207 463 "-" "Microsoft-WebDAV-MiniRedir/10.0.18362" "-"
xxx.xxx.xxx.xxx - username [29/Sep/2019:15:21:33 +0800] "LOCK /config HTTP/2.0" 405 157 "-" "Microsoft-WebDAV-MiniRedir/10.0.18362" "-"
xxx.xxx.xxx.xxx - username [29/Sep/2019:15:22:52 +0800] "PROPFIND /macOS%20Files HTTP/2.0" 207 448 "-" "Microsoft-WebDAV-MiniRedir/10.0.18362" "-"
xxx.xxx.xxx.xxx - username [29/Sep/2019:15:22:52 +0800] "PROPFIND /desktop.ini HTTP/2.0" 404 153 "-" "Microsoft-WebDAV-MiniRedir/10.0.18362" "-"
xxx.xxx.xxx.xxx - username [29/Sep/2019:15:22:52 +0800] "PROPFIND / HTTP/2.0" 207 424 "-" "Microsoft-WebDAV-MiniRedir/10.0.18362" "-"
xxx.xxx.xxx.xxx - username [29/Sep/2019:15:22:52 +0800] "PROPFIND / HTTP/2.0" 207 2231 "-" "Microsoft-WebDAV-MiniRedir/10.0.18362" "-"
xxx.xxx.xxx.xxx - username [29/Sep/2019:15:29:09 +0800] "PROPFIND /macOS%20Files HTTP/2.0" 207 448 "-" "Microsoft-WebDAV-MiniRedir/10.0.18362" "-"
xxx.xxx.xxx.xxx - username [29/Sep/2019:15:30:38 +0800] "PROPFIND /macOS%20Files HTTP/2.0" 207 448 "-" "Microsoft-WebDAV-MiniRedir/10.0.18362" "-"
NGINX エラー ログにログ出力がありません。
ご協力に心から感謝します!
答え1
のnginx webdav モジュールPUT、DELETE、MKCOL、COPY、MOVE のみをサポートします。
のdav_ext モジュールPROPFIND、OPTIONS、LOCK、UNLOCK のサポートを追加します。
残念ながら、Windows は、サイズがゼロのファイルの PUT を使用してファイルを作成し、その後 PROPPATCH を使用してコンテンツをコピーしようとします。Windows で WebDAV をサポートするために Nginx を使用したところ、うまくいきませんでした。最終的には、モジュールdav
とdav_fs
モジュールを使用して Apache を使用することにしました。
答え2
そこから設定を使ってみてくださいhttp://netlab.dhis.org/wiki/ru:software:nginx:webdav それは私にとって仕事です。