lighttpd is a high performance web-server that can serve well as an "asset server". At Edoceo we use lighttpd to power content distribution network. When implemented we saw a large reduction in load on our primary web server and increased performance of our sites as a whole.
Simply set the USE flags and emerge, this is what ours looks like.
carbon # emerge -pv lighttpd [ebuild N ] www-servers/lighttpd-1.4.20 USE="bzip2 -doc -fam -fastcgi \ gdbm ipv6 -ldap -lua -memcache -minimal -mysql pcre -php -rrdtool ssl \ -test -webdav xattr" 604 kB
When lighttpd will be functioning in a CDN it may be necessary to adjust some modules as well as add a few additional mime types.
We choose to disable almost all modules possible, here is a snip from lighttpd.conf
server.modules = (
"mod_access",
"mod_status",
"mod_simple_vhost",
"mod_accesslog"
)
# we comment this out because everything from the CDN is static
#static-file.exclude-extensions = (".php", ".pl", ".cgi", ".fcgi")
We also had to update the mime-types so lighttpd would return scripting language files as text. We added these lines to the mime-types.conf file distributed with lighttpd.
".dmg" => "application/x-apple-diskimage", # return these scripts as text ".php" => "text/plain", ".pl" => "text/plain", ".sh" => "text/plain",