Plugin: SCGI

Version
0.1.1
Size
12 k
Author
ambitionframework.org <ambitionframework -dot- org>
Description
Provide built-in support for a SCGI engine.
Last Updated
2016-12-22
Views
965

SCGI

What is it for?

The SCGI Engine plugin provides engine support for connecting to a SCGI-compliant web server. This can provide faster responses and better reliability than proxying through the built-in Raw engine in Ambition.

Most web servers provide SCGI support. These include, but are not limited to: * Apache * Lighttpd * Microsoft IIS (with ISAPI SCGI extension) * nginx

Installation and Configuration

The engine-scgi plugin can be installed using the usual Ambition plugin tool, and can be used immediately without configuration with sensible defaults. The plugin will link with your application. To always use SCGI, app.engine must be set to SCGI in your configuration file. Otherwise, to use the SCGI for one session, execute:

ambition run --engine SCGI

To change the configuration of the SCGI plugin, you may use the ambition shell. To set the engine to SCGI, execute:

ambition scgi configure

To set the engine using another port, add the port to the end. All values will replace previous instances.

ambition scgi configure 3201

Otherwise, edit your application's configuration file in the config/ directory.

scgi.port - Listening port of the SCGI server, and should match the web server configuraion. Defaults to 3200.

scgi.threads - Number of listening threads for the SCGI server. Defaults to 10.

Configuring a Web Server

nginx

server {
    listen 80;
    location / {
        include scgi_params;
        scgi_pass 127.0.0.1:3200;
    }
    location /static {
        root /path/to/your/application/;
    }
}

Apache 2.x

<VirtualHost *:80>
    DocumentRoot /path/to/empty/directory;
    Alias /static/ /path/to/your/application/static/;
    SCGIMount / 127.0.0.1:3200
    <LocationMatch "/static">
        SCGIHandler Off
    </LocationMatch>
</VirtualHost>