Posted onIntutorialViews: Word count in article: 2.9kReading time ≈3 mins.
In last post, I migrate Navidrome using Nignx. Now, I try to upload new songs to server using WebDav, I find it cannot connect to server. After searching around, I found the solution. This is because the basic nginx in Ubuntu does not contains all function of WebDav. Now, let solve this issue together.
How to refine
Log into your server as root.
1 2 3
apt install nginx-full apt install libnginx-mod-http-headers-more-filter vim /etc/nginx/nginx.conf
1 2 3 4 5
#add below in http block for mac OS client lock support. Other setting remains the same, I do not mean to delete all other settings. I just want to make things simpler so other settings are omitted.
# WebDAV Configuration location /webdav { alias /var/www/music; auth_basic"WebDAV Restricted"; auth_basic_user_file /etc/nginx/.htpasswd; autoindexon; # Enable Directory Indexing # Enable full directory creation support. By default, the Put method can only create files in existing directories. create_full_put_pathon; dav_access user:rw group:rw all:r; # Add a slash after the URI of various methods to solve the compatibility problem of webdav clients on various platforms set$dest$http_destination; if (-d $request_filename) { rewrite ^(.*[^/])$$1/; set$dest$dest/; }
if ($request_method~ (MOVE|COPY)) { more_set_input_headers'Destination: $dest'; }
if ($request_method~ MKCOL) { rewrite ^(.*[^/])$$1/ break; }
# Support all methods of WebDav dav_methods PUT DELETE MKCOL COPY MOVE; dav_ext_methods PROPFIND OPTIONS LOCK UNLOCK; dav_ext_lock zone=webdav;
#set the max file size can be uploaded client_max_body_size100M; }