title: How do i get node.js express.js on port 80
body: <p>Hello I am trying to run my node.js webserver on port 80 on Ubuntu 12.04.2. This machine is a clean install and the only thing I have installed is, openssh-server nodejs and screen. When I run the node webservice on port 80, I can navigate to the browser and type in localhost and i will view my site. However when i try to access the site from a different machine i get timed out. I can however SSH and PING the machine. How can i setup ubuntu so that my node.js application is serving my website. The site works just fine when i host it on my laptop(windows 7) and a different laptop access the site by my ip address. </p>
  
  <p>I do not want to run Apache or nginx. Is there anyway to do this?</p>
  
  <pre><code>    //---ExpressJS
      console.log('Initializing Express...');
      var express = require('express');
      var app = express();
  
      //---Middleware: Allows cross-domain requests (CORS)
      var allowCrossDomain = function(req, res, next){
        res.header('Access-Control-Allow-Origin', '*');
        res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
        res.header('Access-Control-Allow-Headers', 'Content-Type');
        next();
      }
  
      ///---MemoryStore
      //var MemoryStore = express.session.MemoryStore;
  
      //---App config
      app.configure(function() {
        var pub_dir = __dirname + '/public';
        app.set('views', __dirname + '/views');
        app.set('view engine', 'jade');
        app.set("trust proxy", true);
        app.use(express.favicon(__dirname+'/favicon.ico'));
        app.use(express.compress());
        app.use(express.bodyParser());
        app.use(express.cookieParser());
        app.use(express.session({secret: 'cogswell'}));
        app.use(express.methodOverride());
        app.use(allowCrossDomain);
        app.use(app.router);
        app.use(express.static(__dirname));
      });
  
      //---Start listening
      var port = 80;
      app.listen(port);
      console.log('Webservice started on port: '+port);
  </code></pre>
  
  <p>UPDATE: the network has a massive firewall</p>