Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
docs:guide-user:services:nas:webdav [2023/02/28 17:48] – [ZeroConf autodiscovery] stokitodocs:guide-user:services:nas:webdav [2023/03/18 20:24] – [Test it] removed cadaver stokito
Line 8: Line 8:
  
 ==== WebDAV with Lighttpd ==== ==== WebDAV with Lighttpd ====
-Assuming that USB drive is mounted to ''/srv/disk/'' folder.+First of all if you already have the Lighttpd then update it and it's modules to avoid conflicts: 
 +<code bash> 
 +opkg update 
 +opkg list-upgradable | cut -f 1 -d ' ' | grep lighttpd | xargs opkg upgrade 
 +</code> 
 + 
 +Assuming that USB drive is mounted to ''/mnt/disk/'' folder.
  
 <code bash> <code bash>
-mkdir -p /etc/lighttpd/conf.d /srv/disk/dav /var/lib/lighttpd +mkdir -p /etc/lighttpd/conf.d /mnt/disk/dav /var/lib/lighttpd 
-chown http:www-data /srv/disk/dav /var/lib/lighttpd+chown http:www-data /mnt/disk/dav /var/lib/lighttpd
 cat << "EOF" > /etc/lighttpd/conf.d/99-disk.conf cat << "EOF" > /etc/lighttpd/conf.d/99-disk.conf
 $HTTP["url"] =~ "^/dav($|/)" { $HTTP["url"] =~ "^/dav($|/)" {
-  server.document-root := "/srv/disk/"+  server.document-root := "/mnt/disk/"
   auth.backend = "plain"   auth.backend = "plain"
   auth.backend.plain.userfile = "/etc/lighttpd/webdav.shadow"   auth.backend.plain.userfile = "/etc/lighttpd/webdav.shadow"
Line 58: Line 64:
  
 <code bash> <code bash>
-curl -u youruser -X PROPFIND -H "Depth: 1http://192.168.1.1/dav/+curl -u youruser:pass -X PROPFIND -H 'Depth: 1http://192.168.1.1/dav/
 </code> </code>
 You must see a 207 status code and XML response with directory listing. You must see a 207 status code and XML response with directory listing.
  
- +See more details and examples [[https://gist.github.com/stokito/cf82ce965718ce87f36b78f7501d7940|WebDAV with curl]]
-For advanced test install the FTP-like command line client ''cadaver'': +
- +
-<code> +
-cadaver http://192.168.1.1/dav/ +
-Authentication required for webdav on server `192.168.1.1': +
-Username: youruser +
-Password:  +
-dav:/dav/> ls +
-Listing collection `/dav/': succeeded. +
-    README.txt +
-dav:/dav/> cat README.txt  +
-Displaying `/dav/README.txt': +
-It works! +
-dav:/dav/> exit +
-Connection to `192.168.1.1' closed. +
-</code> +
  
 ==== Don't forget about encryption! ==== ==== Don't forget about encryption! ====
Line 89: Line 78:
  
 <code html> <code html>
-cat << EOF > /srv/disk/dav/index.html+cat << EOF > /mnt/disk/dav/index.html
 <!DOCTYPE html> <!DOCTYPE html>
 <html lang="en"> <html lang="en">
Line 98: Line 87:
 </head> </head>
 <body> <body>
-<script src="https://cdn.jsdelivr.net/gh/dom111/webdav-js/src/webdav-min.js"/>+<script src="https://cdn.jsdelivr.net/gh/dom111/webdav-js/src/webdav-min.js"></script>
 </body> </body>
 </html> </html>
  • Last modified: 2024/12/19 14:35
  • by stokito