For the high-resolution orbital slice viewer on the Visible Orbit website, I had to setup wlziipsrv, a fork of the iipsrv large tiled image server. This is a FastCGI app, which means that, unlike a normal CGI which is started up for each request, one runs a number of these processes in daemon mode, and the front-end webserver communicates with them using the fastcgi protocol.

The end-result is this web-based high-resolution image viewer, which you can use to explore several thousands of microsocopic slices of human eyes. This is slice 41 of the S2897L registered set:

To make a long story short, there was no documentation on how to do this on a WebFaction shared host, a problem this post will try to remedy.

The main idea of the solution is to compile and run the lighttpd web server as a custom app, and then to map the fastcgi URL to that app. You can then configure lighttpd to run your fastcgi app. In the following sections, I show you how to do this.

## Configure custom app

Using the webfaction panel, create a custom app as shown in the following screenshot.

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  

Note down the port number that webfaction has allocated for this app. We will setup lighttpd to listen at this port for local access by the frontend webfaction webserver.

Using the website configuration screen of the webfaction panel, associate your new custom app to the fastcgi URL that will be requested. In my case, I have configured the front-end code to invoke the wlziipsrv fastcgi by going to /cgi-bin/wlziipsrv.fcgi. The configuration looks like this:

Here you are telling webfaction that if any client requests /cgi-bin/wlziipsrv.fcgi, it should connect them with whatever’s running behind the specially allocated custom app port. Next we will make sure that lighttpd will answer those requests.



## Configure lighttpd

After building lighttpd with:

cd lighttpd_source_dir
./configure --prefix=\$HOME/opt
make install

 1 2 3 4 5 6  

I created a config file such as the following one in the new custom app directory. Most important is that server.port matches the port number webfaction assigned. I also gave the file a name which will probably not be used by other lighttpd users on the system, namely visorb-lighttpd.conf.

server.document-root = "/home/myusername/webapps/wp_visorb_2017/"

server.port = 22430

server.modules += ( “mod_fastcgi” )

# uncomment this and start with -D to debug requests as they # come in #debug.log-request-handling = “enable”

mimetype.assign = ( ”.html” => “text/html”, ”.txt” => “text/plain”, ”.jpg” => “image/jpeg”, ”.png” => “image/png” )

# webfaction frontend strips away the path; we end up here with only / # however, we KNOW it must be /cgi-bin/wlziipsrv.fcgi fastcgi.server = ( ”/” => (( “socket” => var.mypath + “wlziipsrv-fastcgi.socket”, “check-local” => “disable”, “min-procs” => 1, “max-procs” => 1, “bin-path” => ”/home/myusername/build/WlzIIPSrv/src/wlziipsrv.fcgi”, “bin-environment” => ( “LOGFILE” => var.mypath + “iipsrv.log”, “VERBOSITY” => “5”, “MAX_IMAGE_CACHE_SIZE” => “10”, “FILENAME_PATTERN” => pyr, “JPEG_QUALITY” => “50”, “MAX_CVT” => “3000” ) )) )

 1 2 3 4 5 6  

Test lighttpd by doing:

~/opt/bin/lighttpd -t -f visorb-lighttpd.conf

~/opt/bin/lighttpd -D -f visorb-lighttpd.conf

 1 2 3  

This last command will keep lighttpd running in the foreground just so you can see any log messages. Press Ctrl-C to exit.