Web Oriented Object Framework

User Guide (Version 0.5b4)

User Guide (Version 0.5b4)

SCGI on Apache using mod_proxy_scgi

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 configuring Apache to use SCGI to communicate with a Woof! application server on the back end using the Apache mod_proxy_scgi module. The process of running Woof! as a SCGI application server is described in Running as an SCGI server.

NOTE For versions of Apache that do not come with mod_proxy_scgi, you may wish to use mod_scgi as described in SCGI on Apache using mod_scgi.

The steps below assume you are installing on a Linux or Unix system. Installation on Windows is substantially identical except for path differences.


This scenario makes the following assumptions:

Step 1 - enable mod_proxy_scgi

To enable the module, both the following lines must be added or uncommented in Apache configuration file httpd.conf or equivalent.

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_scgi_module modules/mod_proxy_scgi.so

Step 2 - install Woof!

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

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

This 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. Its subdirectories are intended to be directly served by Apache without going through Woof! as detailed below.

Step 3 - set the document root

Since this is the only application on the server, the document root for Apache must be changed to point to the Woof! public directory by editing the definition of DocumentRoot in httpd.conf.

DocumentRoot /var/myapp/public
<Directory "/var/myapp/public">
  # The options below may need to be changed based on your Apache installation.
  Options Indexes FollowSymLinks
  AllowOverride None
  Require all granted

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

Step 4 - configure SCGI

Apache has to be configured for SCGI by adding the following to httpd.conf:

<Location />
   SetEnvIf Request_URI .* proxy-scgi-pathinfo
   ProxyPass scgi://localhost:9999/

<LocationMatch "^/(stylesheets|images|js|html)/">
   ProxyPass !

The <Location> directive specifies that all URL's should be passed on to the SCGI server on port 9999. We then create exceptions for the directories containing static resources using <LocationMatch> so that they are directly served by Apache without bothering Woof!.

The SetEnvIf directive sets the Apache environment proxy-scgi-pathinfo. Without this, mod_proxy_scgi does not set or pass the PATH_INFO environment used in CGI/SCGI to map requests.

Step 5 - 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.

Completing the installation

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