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:

visorb-s2897l-reg-slice41.png

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.

screenshot_2017-06-06_08-56-31.png

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
<p>
  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.
</p>

<p>
  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 <code>/cgi-bin/wlziipsrv.fcgi</code>. The configuration looks like this:
</p>

<div class="figure">
  <p>
    <a href="/wp-content/uploads/2017/06/screenshot_2017-06-06_09-12-52.png?ssl=1"><img src="/wp-content/uploads/2017/06/screenshot_2017-06-06_09-12-52.png?resize=300%2C47&#038;ssl=1" alt="screenshot_2017-06-06_09-12-52.png" data-recalc-dims="1" /></a>
  </p></p>
</div>

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

Configure lighttpd

After building lighttpd with:

cd lighttpd_source_dir
./configure --prefix=$HOME/opt
make install
1
2
3
4
5
6
<p>
  I created a config file such as the following one in the new custom app directory. Most important is that <code>server.port</code> 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 <code>visorb-lighttpd.conf</code>.
</p>

<div class="org-src-container">
  <pre class="src src-conf"><span style="color: #0084C8; font-weight: bold;">server.document-root</span> = <span style="color: #4E9A06;">"/home/myusername/webapps/wp_visorb_2017/"</span>

server.port = 22430

server.modules += ( “mod_fastcgi” )

var.mypath = ”/home/myusername/webapps/visorb_iipsrv/”

# 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
<p>
  Test lighttpd by doing:
</p>

<div class="org-src-container">
  <pre class="src src-sh">~/opt/bin/lighttpd -t -f visorb-lighttpd.conf

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

1
2
3
<p>
  This last command will keep lighttpd running in the foreground just so you can see any log messages. Press <code>Ctrl-C</code> to exit.
</p>