-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlighttpd-webdavjs.conf
175 lines (153 loc) · 5.29 KB
/
lighttpd-webdavjs.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#Lighttpd WebDAV + webdav-js quickstart config
#Please read through the file and fill in all the variables with your choices
#It will be quick, we promise!
server.modules = (
"mod_webdav",
"mod_rewrite"
)
### Main configuration ###
#========================#
#Directory to be served over WebDAV
server.document-root = "/path/to/serve/"
#Enable/disable read-only access
webdav.is-readonly = "disable"
#Directory containing the dav-assets subdirectory with webdav-js assets
var.index-assets-dir = "/path/to/static-assets/"
#URL prefix to serve plain file indexes over
var.plainindex-prefix = "/basic/"
#Path where mod_webdav can store a temp file
webdav.sqlite-db-name = "/tmp/webdav_lock.db"
### Protocol support ###
#======================#
## 1. Fill in the following options with the values of your choice:
# --- Fill below if using HTTP ---
#HTTP server port
var.http_port = 8080
# --- Fill below if using HTTPS ---
#HTTPS server port
var.https_port = 443
#path to the PEM file certificate chain
var.ssl_pemfile = "/path/to/pemfile.pem"
#path to the PEM file private key (both variables may point to a same file)
var.ssl_privkey = "/path/to/privkey.pem"
## 2. Leave one of the following three option blocks uncommented out to select
## the protocols you wish:
#>>> [] HTTP only
server.port = http_port
#>>> [] HTTP + HTTPS
#server.port = http_port
#server.modules += ("mod_openssl")
#$SERVER["socket"] == "0.0.0.0:" + https_port {
# ssl.engine = "enable"
# ssl.privkey = ssl_privkey
# ssl.pemfile = ssl_pemfile
#}
#>>> [] HTTPS only
#server.port = https_port
#server.modules += ("mod_openssl")
#ssl.engine = "enable"
#ssl.privkey = ssl_privkey
#ssl.pemfile = ssl_pemfile
### Auto HTTP -> HTTPS session upgrading for modern browsers ###
#==============================================================#
## If using HTTP + HTTPS mode, uncomment this to enable automatic upgrading of
## requests to HTTPS when a modern browser is detected
## Note: Currently ONLY WORKS IF the defaults ports of 80 and 443 are used
## Help needed figuring out a better approach
#server.modules += ("mod_redirect")
#$SERVER["socket"] == "0.0.0.0:" + http_port {
# $REQUEST_HEADER["Upgrade-Insecure-Requests"] != "" {
# url.redirect = ("" => "https://${url.authority}")
# url.redirect-code = 308
# }
#}
###################################
# You're all set configuring now! #
###################################
#Dragons be here from this line on
dir-listing.activate = "enable"
dir-listing.encoding = "utf-8"
dir-listing.hide-dotfiles = "disable"
webdav.activate = "disable"
$HTTP["url"] !~ "^" + plainindex-prefix {
webdav.activate = "enable"
$HTTP["request-method"] == "GET" {
url.rewrite-once = ( "\/$" => "/dav-assets/index.html" )
$HTTP["url"] =~ "^\/dav-assets\/|^\/favicon.ico$" {
dir-listing.activate = "disable"
server.document-root := index-assets-dir
}
}
}
$HTTP["url"] =~ "^" + plainindex-prefix {
url.rewrite-once = ( "^" + plainindex-prefix + "(.*)" => "/$1" )
}
#Workaround for mod_webdav returning 403 on MOVE
#Haves the unfortunate side effect of moving always clobbering existing files
server.modules += ("mod_setenv")
$HTTP["request-method"] == "MOVE" {
setenv.set-request-header = ("Overwrite" => "")
}
#Mimetypes for several of the formats webdav-js offers rich previews for plus
#a handful more useful ones
mimetype.assign = (
".apk" => "application/zip",
".asc" => "text/plain; charset=utf-8",
".asf" => "video/x-ms-asf",
".asx" => "video/x-ms-asf",
".avi" => "video/x-msvideo",
".c" => "text/plain; charset=utf-8",
".conf" => "text/plain; charset=utf-8",
".cpp" => "text/plain; charset=utf-8",
".css" => "text/css; charset=utf-8",
".dtd" => "text/xml",
".dvi" => "application/x-dvi",
".flac" => "audio/flac",
".gif" => "image/gif",
".gz" => "application/x-gzip",
".htm" => "text/html",
".html" => "text/html",
".jpeg" => "image/jpeg",
".jpg" => "image/jpeg",
".js" => "text/javascript",
".log" => "text/plain; charset=utf-8",
".m3u" => "audio/x-mpegurl",
".md" => "text/plain; charset=utf-8",
".mkv" => "video/x-matroska",
".mov" => "video/quicktime",
".mp3" => "audio/mpeg",
".mp4" => "video/mp4",
".mpeg" => "video/mpeg",
".mpg" => "video/mpeg",
".ogg" => "application/ogg",
".ogv" => "video/ogg",
".opus" => "audio/ogg",
".otf" => "font/otf",
".pdf" => "application/pdf",
".png" => "image/png",
".ps" => "application/postscript",
".qt" => "video/quicktime",
".sh" => "text/plain; charset=utf-8",
".sig" => "application/pgp-signature",
".spec" => "text/plain; charset=utf-8",
".svg" => "image/svg+xml",
".swf" => "application/x-shockwave-flash",
".tar" => "application/x-tar",
".tar.gz" => "application/x-tgz",
".text" => "text/plain; charset=utf-8",
".tgz" => "application/x-tgz",
".torrent" => "application/x-bittorrent",
".ttf" => "font/ttf",
".txt" => "text/plain; charset=utf-8",
".wav" => "audio/x-wav",
".wax" => "audio/x-ms-wax",
".webm" => "video/webm",
".wma" => "audio/x-ms-wma",
".wmv" => "video/x-ms-wmv",
".woff" => "font/woff",
".woff2" => "font/woff2",
".xml" => "text/xml",
".zip" => "application/zip",
# Fallback default mimetype
"" => "application/octet-stream",
)