An Open Access Peon

25 October 2013

Passenger Fusion-Nginx Node.js App Server for Ubuntu

Download and install Passenger Fusion from https://www.phusionpassenger.com/download#open_source. Install nginx and passenger:

sudo apt-get install nginx-full passenger

Download and install node.js from https://launchpad.net/~chris-lea/+archive/node.js/:

sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs


In /etc/nginx/nginx.conf uncomment passenger_root and passenger_ruby:

passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /usr/bin/ruby;


In /etc/nginx/sites-available/default add at the end of the server {} block:

server {
...
       passenger_enabled on;
       location /app1/ {
               root /home/user/webapps/app1/public;
               passenger_enabled on;
       }
}


Follow the instructions at https://github.com/phusion/passenger/wiki/Node.js to create the app structure under /home/user/webapps/app1:

./public
./tmp
./tmp/restart.txt [touch this to re-deploy application]
./app.js


app.js is a normal Node.js Web application (something that uses 'http.createServer().server.listen()').

Restart nginx:

sudo /etc/init.d/nginx restart

Then test your app:

curl http://localhost/app1/

0 Comments:

Post a comment

<< Home