mike watkins dot ca : QP, lighttpd, SSL and SCGI

QP, lighttpd, SSL and SCGI

A version of QP supporting Python 3.0 (and prior Python versions of course) will be released when Python 3.0 soon hits the streets. While doing some testing I created a lighttpd configuration example illustrating setting up a virtual host with SCGI (QP provides http and scgi servers natively) and SSL support:

QP with lighttpd

lighttpd is a lightweight web server that includes support for both SCGI and SSL. As noted in the Apache configuration example regarding "https_address" and "as_http_address", the same caveats apply. If you find it necessary to create a SSL "pemfile":

$ cat server.key server.crt > server.pem

The following are the minimum lighttpd.conf customizations required to enable SCGI and set up a virtual host for http and https:

server.modules = ("mod_access",
                  "mod_scgi",
                  "mod_accesslog")

$HTTP["host"] == "www.example.com" {
    $SERVER["socket"] == "0:443" {
        ssl.engine = "enable"
        ssl.pemfile = "/my/ssl/server.pem"
        ssl.ca-file = "/my/ssl/server.crt"
    }
    scgi.server = ( "" =>
        ( "localhost" =>
            ( "host" => "127.0.0.1",
              "port" => 9000,
              "check-local" => "disable",
              # default disable-time is 60 seconds
              "disable-time" => 5 # seconds
            )
        )
    )
}

Update

Wednesday November 12: After noting a post by Eric Mortiz I put together a set of results comparing both Apache and lighttpd proxy and SCGI front ends to a QP web / SCGI server. My results seem different than Eric's:

==================================================
QP web server direct    2.38 [ms] (mean)
lighttpd 1.4.20
lighttpd proxy to QP    2.41 [ms] (mean)
lighttpd SCGI           2.31 [ms] (mean)

APACHE 1.3.41
APACHE 1.3 proxy to QP  3.39 [ms] (mean)
APACHE 1.3 mod_scgi     2.30 [ms] (mean)
==================================================

Details in the attached file

qp-scgi-vs-proxy.txt (5.9 KB, text/plain)
Simple benchmark comparing lighttpd and Apache proxy and SCGI access to a QP web application server.