Running as a FastCGI Application

The ScaleOut Management REST Service can be run as a FastCGI application behind any web server that supports fixed TCP ports, UNIX-style sockets, or standard I/O file descriptors.

Note

Microsoft Internet Information Services (IIS) is currently not supported for FastCGI. If FastCGI usage is required then consider either deploying the REST API service to a Linux host or installing an alternative web server on your Windows system.

TCP

To use TCP ports, the service executable should be run with the “-mode=tcp” command line argument. E.g., /usr/local/soss/soss_mgt_rest -mode=tcp. The service will accept FastCGI requests passed to the TCP port specified by Net.Port in the configuration file (or, alternatively, the -port command line argument). See Configuration File for more detail on this configuration parameter.

UNIX Sockets

To use named UNIX sockets, the service executable should be run with the “-mode=stdio” and “-unix” command line arguments, specifying the filesystem pathname to the named socket. E.g., /usr/local/soss/soss_mgt_rest -mode=unix -unix=/tmp/myprogram.sock. The service will accept FastCGI requests passed to the named socket.

Standard I/O

To use standard I/O (stdin and stdout), the service executable should be run the “-mode=stdio” command line argument. E.g., /usr/local/soss/soss_mgt_rest -mode=stdio. The service will accept FastCGI requests passed to the standard input and output file descriptors.

Example Web Server Configurations

Note

The below samples are provided as a quick start for reference only. Proper configuration of web servers can be complex. If in doubt, consult the product documentation for the web server software.

Nginx Example

To configure the Nginx web server to forward HTTP requests to the ScaleOut Management REST Service as a FastCGI module, a sample virtual host configuration entry may look like the following:

Sample Nginx Configuration.

server {
     listen 80;
     server_name _;
     root /var/www;
     index index.html;

     location ~ / {
          include fastcgi.conf;
          # FastCGI passthru to TCP port 4000 on localhost
          fastcgi_pass 127.0.0.1:4000;

          # Alternatively, to passthru to a UNIX socket at /tmp/nginx4001.socket
          # Uncomment the following line (and comment the above fastcgi_pass directive):
          #fastcgi_pass unix:/tmp/nginx4000.socket;
     }

     try_files $uri $uri.html =404;
}

Note

Nginx does not automatically launch the FastCGI process if the process is not running. Typically, this results in a 502 Bad Gateway error.

Apache HTTP Example

Configuring the Apache HTTP web server to support FastCGI requires the use of a FastCGI module, such as mod_fastcgi or mod_fcgid.

To configure the Apache HTTP web server to forward HTTP requests to the ScaleOut Management REST Service as a FastCGI module, a sample configuration might look like the following:

Sample Apache Configuration.

# Redirect requests from / to the FCGI application
ScriptAlias / /usr/local/soss/soss_mgt_rest

# Configuration for mod_fastcgi, if enabled
<IfModule mod_fastcgi.c>
  # Assumes the below directory is writeable by the Apache user!
  FastCgiIpcDir /tmp/fcgi
  FastCgiServer /usr/local/soss/soss_mgt_rest
  <Directory /usr/local/soss/soss_mgt_rest>
    SetHandler fastcgi-script
  </Directory>
</IfModule>

# Alternative configuration for mod_fcgid, if enabled
<IfModule mod_fcgid.c>
  # Assumes the below directory is writeable by the Apache user!
  FcgidIPCDir /tmp/fcgi
  FcgidWrapper /usr/local/soss/soss_mgt_rest
  <Directory /usr/local/soss/soss_mgt_rest>
    SetHandler fcgid-script
  </Directory>
</IfModule>

Note

There are many ways to configure FCGI applications. Check the Apache and mod_fastcgi/mod_fcgid documentation for alternatives.