Skip to content

Instantly share code, notes, and snippets.

@kuno
Forked from jb55/gist:945731
Created April 29, 2011 04:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kuno/947846 to your computer and use it in GitHub Desktop.
Save kuno/947846 to your computer and use it in GitHub Desktop.
replace nginx with connect
var connect = require('connect')
, proxy = require('http-proxy')
function redirect(loc) {
return connect.createServer(function(req, res){
res.writeHead(301, { "Location": loc });
res.end();
});
}
connect(
connect.vhost('stuff.jb55.com', connect.createServer(connect.static(__dirname + "/stuff"))),
connect.vhost('www.jb55.com', redirect("http://jb55.com/")),
connect.vhost('jb55.com', connect.createServer(connect.static(__dirname + "/public"))),
connect.vhost('somesite.jb55.com', proxy.createServer(8083, 'localhost'))
).listen(80);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment