Situación
Configuré un servidor Webdav basado en NGINX con SSL habilitado. Cuando intenté conectarme al servidor desde el Explorador de Windows, todo funciona bien hasta que cargué un archivo. El explorador de Windows dijo.El destino ya tiene un archivo llamado "[nombre de archivo]", y si hace clicReemplazar, Windows solicitóNo se puede leer desde el archivo o disco fuente.
Después del error, actualicé el Explorador de Windows y descubrí que se había creado un nuevo archivo con exactamente el mismo [nombre de archivo] en el servidor Webdav y era de 0 kb (sin datos).
Intenté conectarme con WinSCP y Cyberduck y todo funciona bien, no hay problemas con la carga/descarga.
Pequeña solución
Revisé mi configuración de NGINX y no encuentro ningún problema. Y aquí está mi configuración de 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 {
}
}
}
webdav.conf
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;
}
}
Busqué un poco en Google y encontré esto.artículo. Sin embargo, no ayudó.
Además, intenté configurar el permiso de mi carpeta webdav en 777 y cambié de propietario a nginx, pero no ayudó.
Revisé el registro de acceso de NGINX y encontré esto.
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" "-"
No hay salida de registro en el registro de errores de NGINX.
¡Muchas gracias por tu ayuda!
Respuesta1
Elmódulo nginx webdavsolo admite PUT, DELETE, MKCOL, COPY y MOVE.
Elmódulo dav_extagrega soporte para PROPFIND, OPCIONES, BLOQUEO y DESBLOQUEO.
Desafortunadamente, Windows intenta crear archivos usando un PUT de un archivo de tamaño cero, seguido de un PROPPATCH para copiar el contenido. No he tenido éxito al utilizar Nginx para admitir WebDAV en Windows. Finalmente recurrí al uso de Apache con los módulos dav
y dav_fs
.
Respuesta2
Intenta usar la configuración desde allíhttp://netlab.dhis.org/wiki/ru:software:nginx:webdav Es trabajo para mi.