Follow Phusion Passenger URL for Ubuntu setup https://www.phusionpassenger.com/library/install/nginx/install/oss/trusty/ ( If in future above URL is not present then visit to Phusion Passenger site to select Ubuntu OS and futher instaltion steps.)
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
- sudo apt-get install -y apt-transport-https ca-certificates
- sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main > /etc/apt/sources.list.d/passenger.list'
- sudo apt-get update
-
sudo apt-get install -y nginx-extras passenger
-
rvm sudo passenger-install-nginx-module
- Add passenger_nodejs below passenger_ruby in http block. Like below
passenger_nodejs /home/ubuntu/.nvm/versions/v0.12.5/bin/node;
In passenger_nodejs you need to pass output of "which node" command.
- Comment all lines in first server block and add below lines in first server block.
server_name localhost; # You can pass your domain URL.
passenger_app_root /home/node_demo_app; # full path to node app directory
passenger_enabled on;
passenger_app_type node;
passenger_startup_file server.js; # main file name which start http server
root /home/node_demo_app/public; # full path to node app till public directory
All setup done. Start your nginx sudo /opt/nginx/sbin/nginx and hit server IP("server_name" value).
For stopping server sudo killall nginx.
Thanks!