2. Lighttpd (Cygwin) - ralac/tinypgwebsocketapi GitHub Wiki

In order to prevent lighty from close CGI connection after websocket upgrade, we need to build a patched version of Lightttpd.

Download and patch
git clone https://github.com/ralac/tinypgwebsocketapi
cd tinypgwebsocketapi
git clone https://git.lighttpd.net/lighttpd/lighttpd1.4.git
cd lighttpd1.4
git checkout lighttpd-1.4.50
patch src/mod_cgi.c ../mod_cgi.patch
Build
./autogen.sh
./configure --build=i686-pc-cygwin --with-openssl --prefix=/usr --sbindir=/usr/bin --libdir=/usr/lib/lighttpd/ --sysconfdir=/etc/lighttpd --with-lua
make
make install
Create lighttpd home directory
mkdir -p /var/lib/lighttpd
Configuration files
mkdir -p /etc/lighttpd
cp -a doc/config/*.conf doc/config/*.d /etc/lighttpd/
patch /etc/lighttpd/lighttpd.conf ../lighttpd.conf.patch
patch /etc/lighttpd/modules.conf ../modules.conf.patch
sed -i 's/server.event-handler = "linux-sysepoll"/#server.event-handler = "linux-sysepoll"/g' /etc/lighttpd/lighttpd.conf
Log directory
mkdir -p /var/log/lighttpd
Main host configuration for tinypgwebsocketapi
cat ../lighttpd-tinypgwebsocketapi.conf >> /etc/lighttpd/lighttpd.conf
mkdir /srv/www/htdocs/app
cd ..
ln -s $(pwd) /srv/www/htdocs/app/api
Install and start lighttpd service
cygrunsrv -I lighttpd -d "CYGWIN Lighttpd" -p /usr/bin/lighttpd -a "-D -f /etc/lighttpd/lighttpd.conf"
cygrunsrv -S lighttpd