Cloud Computing: The Digital Shift 2.0 – Understanding the Current Market Trends

4 steps to install nginx with passenger

Install passenger program that will run your rails application
1. sudo gem install passenger
Install nginx server with passenger enabled
2. passenger-install-nginx-module

it will open apt, click “Enter” to contine
then select option 1 for default install
then it will ask
Where do you want to install Nginx to?

Please specify a prefix directory [/opt/nginx]:
press enter

then copy following block

server {
listen 80;
root /somewhere/public;   # <— be sure to point to ‘public’!
passenger_enabled on;

Make nginx Configuration
3. vi /opt/nginx/conf/nginx.conf
Make passenger_root and passenger_ruby path to configuration

http {
passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.4;
passenger_ruby /usr/local/bin/ruby;

then add server configuration block inside http block

server {
listen 80;
server_name; //Make sure this dns entry inside /etc/hosts
root /carsonline/public;   # <— be sure to point to ‘public’! //here carsonline is RAILS_ROOT
passenger_enabled on;

Thats, all

4. Launch Server


0 thoughts on “4 steps to install nginx with passenger”

  1. Hi Sandip,

    I have recently configured nginx-passenger.
    With the latest version of passenger
    passenger (5.0.7)
    I am able to start nginx and getting default page of nginx saying ..”Welcome to nginx!”

    But I am not sure why definded project is not running with this:

    Though it’s working when I run with “passenger start -e production”

    Find below configurations which i did :

    server {
    listen 80;
    root /home/rahul/work_space/redmine/public;
    passenger_enabled on;
    rails_env production;


    http {
    passenger_root /home/rahul/.rvm/gems/ruby-1.9.3-p194@my-projecttracker/gems/passenger-5.0.7;
    passenger_ruby /home/rahul/.rvm/wrappers/ruby-1.9.3-p194@my-projecttracker/ruby;

    Can you suggest what I have missed ?

    Advance thanks for yout help…:)

Leave a Comment

Your email address will not be published.