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
|
#! /bin/sh
CONF=$SNAP_APP_DATA_PATH/lighttpd.conf
BIN=$SNAP_APP_PATH/usr/sbin/lighttpd
PORT=80
if [ -e $SNAP_APP_DATA_PATH/config.yaml ]; then
PORT=$(grep -A1 webdav $SNAP_APP_DATA_PATH/config.yaml|\
grep port:|sed "s:.*port\: ::")
fi
cat << EOF >$CONF
server.modules = (
"mod_access",
"mod_alias",
"mod_compress",
"mod_redirect",
"mod_webdav",
# "mod_rewrite",
)
server.document-root = "$SNAP_APP_DATA_PATH/Media"
server.upload-dirs = ( "$SNAP_APP_DATA_PATH/lighttpd/uploads" )
server.errorlog = "$SNAP_APP_DATA_PATH/lighttpd/error.log"
server.pid-file = "$SNAP_APP_DATA_PATH/lighttpd.pid"
server.port = $PORT
webdav.activate = "enable"
webdav.is-readonly = "disable"
webdav.sqlite-db-name = "$SNAP_APP_DATA_PATH/lighttpd/lighttpd.webdav_lock.db"
index-file.names = ( "index.php", ".index.html", "index.lighttpd.html" )
url.access-deny = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
compress.cache-dir = "$SNAP_APP_DATA_PATH/lighttpd/compress/"
compress.filetype = ( "application/javascript", "text/css", "text/html", "text/plain" )
# default listening port for IPv6 falls back to the IPv4 port
## Use ipv6 if available
#include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "$SNAP_APP_PATH/usr/share/lighttpd/create-mime.assign.pl"
include_shell "$SNAP_APP_PATH/usr/share/lighttpd/include-conf-enabled.pl"
EOF
chmod 0600 $CONF
[ -e $SNAP_APP_DATA_PATH/lighttpd/compress ] || mkdir -p $SNAP_APP_DATA_PATH/lighttpd/compress
[ -e $SNAP_APP_DATA_PATH/lighttpd/uploads ] || mkdir -p $SNAP_APP_DATA_PATH/lighttpd/uploads
touch $SNAP_APP_DATA_PATH/Media/.index.html
$BIN -D -f $CONF -m $SNAP_APP_PATH/usr/lib/lighttpd
|