Hosting Interchange on Nginx

A while back, Geert van der Spoel made a public statement about how to run Interchange on nginx, a very fine webserver which I like and use since a few years ago.

Geert's notes got me on track to finally attempt to abandon Apache for our Interchange hosting as well, and, although in a hurry, I converted my website to a similar scheme. As the way Geert interfaces to the Interchange stuff seemed too complicated to me, and since we do not have much traffic, I thought that there should be an easy way. Therefore, instead of creating a Perl-based FastCGI launcher, I simply perused the provided link programs, which I then start using fcgiwrap (thanks, Grzegorz!). Also, in contrast to earlier deployments, I wanted to stay within standard system configurations and packaging, too. Our URL configuration is such that all URLs go to Interchange, except for static images and such.

The relevant part of our nginx configuration now looks like this (Debian host):

# standard Debian location for Interchange
location ^~ /cgi-bin/ic {
    root        /usr/lib;
    fastcgi_pass unix:/var/run/fcgiwrap.socket;
    # this stuff comes straight from Geert:
    gzip off;
    expires off;

    set $path_info $request_uri;
    if ($path_info ~ "^([^\?]*)\?") {
        set $path_info $1;

    include                     fastcgi_params;
    fastcgi_read_timeout        5m;
    # name your shop's link program:
    fastcgi_index               /cgi-bin/ic/shop1;

    fastcgi_param SCRIPT_NAME /cgi-bin/ic/shop1;
    fastcgi_param SCRIPT_FILENAME /usr/lib/cgi-bin/ic/shop1;
    fastcgi_param PATH_INFO $path_info;
    fastcgi_param HTTP_COOKIE $http_cookie;