Browse Source

Add nginx example

chrysn 4 years ago
parent
commit
dbfe8f3f01

+ 15 - 0
examples/nginx/README.md

@@ -0,0 +1,15 @@
+# Nginx Directory List Example
+
+To utilise this example, you'll need a running nginx server with the fancyindex
+module and (obviously) WebDAV enabled.
+
+Copy the files in this directory to /usr/local/share/webdavjs-nginx/, and add
+the following line to your server config:
+
+```
+include /usr/local/share/webdavjs-nginx/webdavindex.conf;
+```
+
+By using the fancyindex module and having the module's generated index under
+\<noscript\> tags, a directory index is still available to clients that can not
+use JavaScript, including `wget` or MPD's curl storage plugin backend.

+ 3 - 0
examples/nginx/davindex-footer.html

@@ -0,0 +1,3 @@
+</noscript>
+</body>
+</html>

+ 12 - 0
examples/nginx/davindex-header.html

@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width">
+<!-- The fancy index's own default style -->
+<style type="text/css">noscript tr:nth-child(even) {background:#f4f4f4;}noscript th,td {padding:0.1em 0.5em;}th {text-align:left;font-weight:bold;background:#eee;border-bottom:1px solid #aaa;}noscript #list {border:1px solid #aaa;width:100%;}</style>
+<script>["https://cdn.jsdelivr.net/gh/dom111/webdav-js@feature/file-information-on-preview/assets/css/style-min.css","https://cdn.jsdelivr.net/gh/dom111/webdav-js@feature/file-information-on-preview/src/webdav-min.js"].forEach((function(e,s){/css$/.test(e)?((s=document.createElement("link")).href=e,s.rel="stylesheet"):(s=document.createElement("script")).src=e,document.head.appendChild(s)}));</script>
+</head>
+<body>
+<noscript>
+<h1>Index of

+ 10 - 0
examples/nginx/webdavindex.conf

@@ -0,0 +1,10 @@
+fancyindex on;
+fancyindex_header /+dav/header.html;
+fancyindex_footer /+dav/footer.html;
+
+location /+dav/header.html {
+        alias /usr/local/share/webdavjs-nginx/davindex-header.html;
+}
+location /+dav/footer.html {
+        alias /usr/local/share/webdavjs-nginx/davindex-footer.html;
+}