lighty's life

lighty developer blog

Lighttpd on Cygwin

I spent some hours in the airport of Hong-Kong and wanted to get the 1.3.x branch running on cygwin in combination with PHP via FastCGI. On the road I most often work under Windows on my Laptop and being able to really test it under every platform, even cygwin is a nice to have.

It was already spawned automaticly by the internal spawner after I had compiled PHP in cygwin myself with FastCGI support. The only thing missing was a working FastCGI handler. Debugging in cygwin is a lot harder than doing the same under Linux as the strace is tracing the emulated environment and not the native system calls:

$ strace —mask=syscall .libs/lighttpd.exe -D -f ./lighttpd.conf

Adding a bunch of log_error_write() statements in the mod_fastcgi.c code somewhen revealed what is really going on. I still wonder why it ever worked at all :)

changeset 343 is the final result of this debug session and will be part of 1.3.14 moving the ‘please send me FDEVENT_IN’ before we return with WAIT_FOR_EVENT. This also removes the ‘I got FDEVENT_OUT and don’t know way’ messages than sometimes appeared.

Advanced Configuration in Up Upcoming 1.4.x

i’m moo, new to lighttpd

As many of you might ask: “how do i write cond1 AND cond2”. we have the answer in 1.4

i focused on the configuration of the upcoming lighttpd1.4. i made many improvements to her.

One of the most noticeable change is nesting and chaining, as you might already known as “and” / “else”:

cond_a {
cond_b {
else cond_c {

cond_b will match only if cond_a match first, and cond_c will not match if cond_a match first. the order the condition checked/patched is same as other programming language, c, perl, php etc.

also, “user-defined” variable and “include” is impemented. if you used to copy/paste many of your config for each vhost, u can now put them into a sub config file, and even use the variable:

. in lighttpd.conf
$HTTP[“host”] == “”{“t1”
include “myvhost.conf”
$HTTP[“host”] == “”{“t2”
include “myvhost.conf”
. in myvhost.conf = + “”
server.document-root = “/mydocroot/” + + “/public_html/”

you can also use config values such as + “/…”, and even use env.* to get environment variable

i’ve also implemented(but not commited yet) “include_shell”, which parse the output of program which convert some on the fly. for example:

include “mysub.conf”

  1. compare the above line to the following
    include_shell “/usr/bin/convmimetype /etc/mime.types”
  2. same as mime.assign = array(…)

notice the above is all at config parsing time(when loading config), so no performance lost. runtime variable isn’t implemented yet. i have no idea how it should be implemented exactly, nor do i know how to avoid hurting performance.

there are more, optimization for runtime condition checking, pcre_study speed up for regex matching, new command line options(check with -h).

FIY, before i implement these things. i myself use m4, a macro language to write the config. it’s powerful but ugly and dirty, and is just a brain dead game. i can use variable/include in m4, but not output “else” “and”. but i can now do all what i needed in lighttpd alone without m4.

check news when 1.4 is out, or check svn :)

Logo Contest for Lighty

A few days ago I’ve sent out a message about the logo contest and I already received a nice set of proposals. The idea was to collect some ideas for a while and see how they develop. My current favorites are the one by Tobin Jones and Matt Wood as they cover the idea of the word light the best.