Lighttpd

From Alessandro's Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

core

Keep-Alive

Disabling keep-alive might help your server if you suffer from a large number of open file descriptors.

  • defaults:
server.max-keep-alive-requests = 128
server.max-keep-alive-idle = 30
server.max-read-idle = 60
server.max-write-idle = 360
  • less...
server.max-keep-alive-requests = 8
server.max-keep-alive-idle = 8
  • Disabling keep-alive
server.max-keep-alive-requests = 0


modules

x264-streaming

aio-sendfile

./configure --with-openssl --with-linux-aio
  • in lighttpd.conf
server.network-backend = "linux-aio-sendfile"

sec download

 secdownload.secret        = <string>
 secdownload.document-root = <string>
 secdownload.uri-prefix    = <string>  (default: /)
 secdownload.timeout       = <short>   (default: 60 seconds)
secdownload.secret          = "password"
secdownload.document-root   = "/export/mediaroot/auth/"
secdownload.uri-prefix      = "/dl/"
secdownload.timeout         = 120
  • php then..
<uri-prefix>/<token>/<timestamp-in-hex>/<rel-path>

PHP Example

  <?php

  $secret = "verysecret";
  $uri_prefix = "/dl/";

  # filename
  # please note file name starts with "/" 
  $f = "/secret-file.txt";

  # current timestamp
  $t = time();

  $t_hex = sprintf("%08x", $t);
  $m = md5($secret.$f.$t_hex);

  # generate link
  printf('<a href="%s%s/%s%s">%s</a>',
         $uri_prefix, $m, $t_hex, $f, $f);
  ?>