nginx passenger rails No data received

I am new to nginx and passenger and want to use it to run a rails application.

I have installed nginx and passenger on my mac ( passenger-install-nginx-module ).

I can start the nginx server and see the default nginx welcome screen.

I want to run a rails app on my nginx server.

I have added the following to the nginx.conf :

server {
  listen 8080;
  server_name localhost;
  root /myrailsApp/public;   # <--- be sure to point to 'public'!
  passenger_enabled on;
}

When I start my nginx server and navigate to localhost:8080 I see the message:

"No data received" (Error code: ERR_EMPTY_RESPONSE)

I am guessing this is a silly mistake that I have overlooked? Could someone please point me in the right direction?


Bit more information that may help.

which ruby returns:

/Users/user/.rvm/rubies/ruby-1.9.3-p429/bin/ruby

I installed using:

gem install passenger

passenger-config --root returns:

/Users/user/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2ndEd/gems/passenger-4.0.20

Is this ( @rails3tutorial2ndEd/gems/passenger-4.0.20 ) not a little strange ?

I then ran the passenger nginx installer:

passenger-install-nginx-module

As I said, I can start nginx with no problems. I added the new server block to the nginx.conf file pointing to my rails public folder but the page returns

"No data received"


It's looks bit unexpected Error, Below configuration working for me. Once try it out.

#user  nobody;
worker_processes  1;

events {
    worker_connections  1024;
}


http {
    passenger_root /var/lib/gems/1.9.1/gems/passenger-4.0.5;
    passenger_ruby /usr/bin/ruby1.9.1;
    passenger_max_pool_size 10;
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    gzip  on;

    server {
      listen       80;
      server_name  localhost;
      access_log /var/www/access.log;
      error_log  /var/www/error.log;

     location / {
        root   /var/www/demo/public;
        passenger_enabled on;
        rails_env production;
     }

     error_page   500 502 503 504  /50x.html;
     location = /50x.html {
        root   html;
    }
}
链接地址: http://www.djcxy.com/p/32490.html

上一篇: NGINX中的env设置不影响乘客

下一篇: nginx乘客轨道没有收到数据