Skip to content Skip to sidebar Skip to footer

Set Up Node So It Is Externally Visible?

Newbie question - might be more appropriate for ServerFault, apologies if so. I'm setting up node on Ubuntu 11.10, following the excellent howtonode instructions on installing Nod

Solution 1:

There is no configuration needed to make your external IP address work with node.js, unless and until you bind it otherwise.

Instead of .listen(PORT, IP_ADDRESS_OR_HOST ); use .listen(PORT);

Then, just use IP_ADDRESS_OR_HOST:PORT to access it.

Solution 2:

You can set up Node to listen on any IP/port, check out http://nodejs.org/docs/v0.6.3/api/http.html#server.listen

Or a quick modified example from the link you supplied:

var http = require('http');

http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello Node.js\n');
}).listen(80, "192.168.1.1");

console.log('Server running at http://192.168.1.1:80/');

Post a Comment for "Set Up Node So It Is Externally Visible?"