No description or website provided.
Latest commit d97b3cc Aug 13, 2012 Liam Oehlman Fixing readme formatting
Failed to load latest commit information.
lib Initial readme commit Aug 13, 2012
templates Changed to include upstream and locations in nginx config Feb 15, 2012
test Fixed for node 0.8.x Aug 13, 2012
Makefile Added makefile for tests Feb 15, 2012 Fixing readme formatting Aug 13, 2012
package.json Fixed for node 0.8.x Aug 13, 2012


This library allows for the generation of a nginx config file from a set of templates. For each endpoint e.g /test there can be many servers attached to it. There can also be many endpoints defined.

Nginx should be build from source for use with this library as the "-p" flag does not seem to work in the nginx ubuntu package.


var proxy = require('nginx-proxy'),
    nginx = new proxy('/path/to/nginx/dir');


Will forward requests for localhost/test to localhost:8000/test

nginx.add(['localhost:8000'], 'test', function(err) {

Will forward request for localhost/test to localhost:8000/test and localhost:8001 via round-robin

nginx.add(['localhost:8000', 'localhost:8001'], 'test'), function(err) {

This will remove localhost:8000 from the /test endpoint

nginx.del(['localhost:8000'], 'test'), function(err) {

After using nginx.add() or nginx.del() changes will be written to disk via rules.json

Generates the nginx config from the rules

nginx.update(function(err) {

Reloads nginx's config and thus applys all rules written from nginx.update()

nginx.reload(function(err) {