Web Oriented Object Framework

User Guide (Version 0.5b4)

User Guide (Version 0.5b4)

SCGI on Lighttpd

NOTE The instructions below have not been updated and may need to be adapted for the latest versions.

The Simple Common Gateway Interface (SCGI) is a standard for communication between web servers and application servers on the back end. It has several performance advantages over CGI. This chapter describes configuration of Lighttpd to use SCGI to communicate with a Woof! application server on the back end. The process of running Woof! as a SCGI application server is described in the chapter Running as an SCGI server.

SCGI is a standard part of the Lighttpd distribution although you may need to enable it as shown below.


This scenario makes the following assumptions:

Step 1 - install Woof!

The next step is to install Woof! for Lighttpd and SCGI using the installer script.

~/woof-dist> tclsh scripts/installer.tcl install lighttpd scgi -installdir /var/myapp

The above command will create the Woof! directory structure under /var/myapp. In particular, the /var/myapp/public will contain the publically accessible directory tree that will be the document root for the dedicated web server. The file scgi_server.tcl in that directory implements the Woof! CGI interface. The other files in the directory, including subdirectories, are intended to be directly served by Lighttpd without going through Woof! as detailed below.

Step 2 - set the document root

Since this is the only application on the server, the document root for Lighttpd must be changed to point to the Woof! public directory by editing lighttpd.conf.

server.document-root = "/var/myapp/public"

Note that the document root points to the public subdirectory, not the Woof! root directory. By default, Lighttpd will now look under the /var/myapp/public directory to locate URL resources.

Step 3 - configure SCGI

Next, SCGI has to be configured and enabled in Lighttpd. First, look for the definition of server.modules and add mod_scgi to enable SCGI. The definition will look similar to the following depending on what other modules you have configured:

server.modules = (
                    "mod_accesslog" )

Next we add the following SCGI configuration.

$HTTP["url"] !~ "\.[^.]+$" {
  scgi.server = (
                  "/" =>
                    ( "" =>
                        "host" => "",
                        "port" => 9999,
			"fix-root-scriptname" => "enable",
                        "check-local" => "disable"

The first line enables SCGI only if the requested URL does not have an extension. The purpose of this is to serve stylesheets and images directly without going through SCGI and Woof!. There are better ways of doing this in Lighttpd 1.5 but that has not released as yet.

The remaining lines configure the host and port that the Woof! SCGI server is running on.

NOTE The setting of the variable fix-root-scriptname is required for some versions of Lighttpd to fix a bug in Lighttpd when it is running a SCGI server rooted at /.

Step 4 - starting the SCGI server

The Woof! SCGI server script that handles connections passed by Apache needs to be started whenever Apache runs. This step is actually independent of the web server and is described in Running as an SCGI server.

NOTE Lighttpd has a mechanism to start the SCGI server through the bin-path attribute in the scgi.server definition. This mechanism will not work with the Woof! SCGI server as Lighttpd in this case will create the listening socket and pass it to the created process as file descriptor 0. Woof! on the other hand expects to create the socket itself.

Completing the installation

Once the steps described there are done, configuration is complete. You can now move on to completing the installation.