Install Node.js with dependacies

sudo apt-get install -y python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

Apache and Node.js on the same Ubuntu server

Install Node.js

apt-get install nodejs
apt-get install npm
 apt-get install build-essential

Install express node module

npm install express

Edit Apache

sudo a2enmod proxy
sudo a2enmod proxy_http
edit the  default apache conf
ProxyRequests Off
<Proxy *>
 Order deny,allow
 Allow from all
 <Location /node>
 ProxyPassReverse  http://server-name:5000
Now restart the apache 
service apache2 restart
The first app
created two files: web.js and package.json
varexpress = require("express");
varapp = express();
app.get('/', function(request, response) {
    response.send('Hello World!');
app.get('/test', function(request, response) {
    response.send('This was only a test');
app.use(function(err, req, res, next){
  res.send(500, 'Something broke!');
varport = process.env.PORT || 8080;
app.listen(port, function() {
    console.log("Listening on "+ port);
  "name": "node-example",
  "version": "0.0.1",
  "dependencies": {
    "express": "3.1.x"
  "engines": {
    "node": "0.10.x",
    "npm": "1.2.x"
Start the app
    node web.js