fastcgi-application

0.0.2 • Public • Published

fastcgi-application

Build Status Dependency Information Code Climate Test Coverage

Run your Node.js server under a FastCGI link from a webserver. Useful if you want to run Node on a shared host, or if you have some kind of middleware you rely on in your webserver.

Quickstart

npm install fastcgi-application --save

You can integrate this into an existing project by simply changing your http.createServer call to use this library.

// i.e change this:
var server = http.createServer(app);
server.listen(PORT);
 
// to this (assuming your FastCGI process manager feeds you requests via stdin)
var server = require("fastcgi-application").listenStdin(app);

A complete example can be seen in example.js.

Your FCGI process manager will need to be able to start up your app directly.

The easiest way to do that is to add a #!/usr/bin/env node hashbang to the top of your entrypoint file and make it executable.

Bear in mind your webserver may run under a user like wwwdata/nobody, so you might need to fix the PATH, as the user probably won't be able to see the node binary.

Lighttpd example

Here's some example config for Lighty.

server.modules += ("mod_fastcgi")
#fastcgi.debug = 1
fastcgi.server = (
  "/nodetest" =>
  ((
    "bin-path" => "/path/to/your/server/entrypoint.fcgi",
    "socket" => "/tmp/nodeapp.sock"
    # or you can use this:
    # "port" => 1666
  ))
)

Then just touch /path/to/www/nodetest.

License

Apache License 2.0

Readme

Keywords

Package Sidebar

Install

npm i fastcgi-application

Weekly Downloads

1

Version

0.0.2

License

Apache-2.0

Last publish

Collaborators

  • samcday