nginx passenger configuration for rails application

#user  nobody;
user www-data;
worker_processes  2;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

events {
    worker_connections  1024;
}

http {
    passenger_root /var/lib/gems/1.8/gems/passenger-2.2.8;
    passenger_ruby /usr/bin/ruby1.8;
    passenger_max_pool_size 3;

    include       mime.types;

default_type  application/octet-stream;
    #log_format  main  ‘$remote_addr – $remote_user [$time_local] “$request” ‘
    #                  ‘$status $body_bytes_sent “$http_referer” ‘
    #                  ‘”$http_user_agent” “$http_x_forwarded_for”‘;
    #access_log  logs/access.log  main;
    sendfile        on;
    #tcp_nopush     on;
    #keepalive_timeout  0;
    keepalive_timeout  65;
    #gzip  on;
 server {
     listen 80;
     server_name localhost;
     root /home/josh/current/public;   # <— be sure to point to ‘public’!
     passenger_enabled on;
     passenger_use_global_queue on;
   }
    server {
        listen       80;
        server_name  localhost;
        #charset koi8-r;
        #access_log  logs/host.access.log  main;
        location / {
            root   html;
            index  index.html index.htm;
        }
     #error_page  404              /404.html;
        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
   }
}
Advertisements

About sandipransing

Web Developer #ruby #rails #JS
This entry was posted in Ruby on Rails and tagged , , . Bookmark the permalink.

3 Responses to nginx passenger configuration for rails application

  1. Sachin Kadam says:

    Hi,
    I am setup ruby 1.9.2 and rails 3.2 on linode server and also installed passenger, nginx. I have also modified the nginx.conf file as shown by you. But still i’m getting error

    Ruby (Rack) application could not be started
    A source file that the application requires, is missing.
    It is possible that you didn’t upload your application files correctly. Please check whether all your application files are uploaded.
    A required library may not installed. Please install all libraries that this application requires.

    Error message:
    no such file to load — /home/grainmeter/src/development/GrainMeter/config/environment

    Exception class:
    LoadError

    Application root:
    /home/grainmeter/src/development/GrainMeter

    Backtrace:
    # File Line Location
    0 config.ru 3 in `require’
    1 config.ru 3 in `block in ‘
    2 /usr/local/rvm/gems/ruby-1.9.2-p318/gems/rack-1.3.6/lib/rack/builder.rb 51 in `instance_eval’
    3 /usr/local/rvm/gems/ruby-1.9.2-p318/gems/rack-1.3.6/lib/rack/builder.rb 51 in `initialize’
    4 config.ru 1 in `new’
    5 config.ru 1 in `’

    My project path is as follows,
    i have made 3 folders namely demo, development, production in src directory.
    1. $ /home/grainmeter/src/demo/GrainMeter#
    2. $ /home/grainmeter/src/development/GrainMeter#
    3. $ /home/grainmeter/src/production/GrainMeter#

    i am trying to run the project from $ /home/grainmeter/src/development/GrainMeter#

    please help me.

  2. Sachin Kadam says:

    its running now

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s