ruby on rails nginx with passenger can't find views

I'm putting together my first ROR app on NginX and Passenger. I'm following tutorials all over the web and I'm getting the following errors when I try to go to my home page.

I created a controller home_controller.rb using the command line. I also created the views at the command line which made a default ERB file.

The nginx service is running and I start passenger manually via "passenger start". I can see passenger accepting the incoming HTTP requests as in the following errors. What's strange though is that it's looking in the public folder of my ruby app for home/index. I used "rails generate [controller/view] foo" which writes files outside of public.

My nginx config is configured to point to the public folder of my ROR project.

I'm using ROR 2.0.0, Phusion Passenger 4.0.29, and nginx 1.1.19.

Am I missing something in Passenger to tell it where the controllers/views/etc. are?

mj

2013/12/13 15:20:12 [error] 18305#0: *4 "/usr/development/sandbox/app/public/index.html" 
is not found (2: No such file or directory), client: 127.0.0.1, server: _, request:     "HEAD / 
HTTP/1.1", host: "0.0.0.0"

2013/12/13 15:20:13 [error] 18305#0: *5 "/usr/development/sandbox/app/public/index.html" 
is not found (2: No such file or directory), client: 127.0.0.1, server: _, request: "GET  
HTTP/1.1", host: "localhost:3000"

2013/12/13 15:20:18 [error] 18305#0: *5 open() 
"/usr/development/sandbox/app/public/home/index" failed (2: No such file or directory), 
client: 127.0.0.1, server: _, request: "GET /home/index HTTP/1.1", host: "localhost:3000"

2013/12/13 15:27:11 [error] 18305#0: *13 open() 
"/usr/development/sandbox/app/public/home/index" failed (2: No such file or directory), 
client: 127.0.0.1, server: _, request: "GET /home/index HTTP/1.1", host: "localhost:3000"

edit 0 - if I use "rails server", everything seems to work fine /edit 0


You are using Phusion Passenger in the wrong way.

Phusion Passenger provides 3 modes: a standalone mode (one that runs as a standalone web server), an Nginx integration mode, and an Apache integration mode. By running passenger start , you are using its standalone mode.

You also have Nginx running. And from your logs, it looks like you are accessing Nginx. But that doesn't do anything. Passenger is running standalone and is not running inside Nginx.

In a diagram:

         Nginx  <--------------------- [Your request]
(Not integrated with Passenger,
 so doesn't know what to do with
 your request)


Passenger Standalone
(waiting for your request,
 but you never sent one
 to it)

So here's how it looks like if you use rails server :

       Nginx
 (not receiving any
  requests from you)


    rails server <--------------- [Your request]

What you actually want is to access Passenger Standalone, which -- just like rails server would -- listens on port 3000. In fact, Passenger Standalone told you during startup that it's listening on port 3000.

       Nginx
 (not receiving any
  requests from you;
  so you may as well
  disable it)


 Passenger Standalone <--------------- [Your request]
链接地址: http://www.djcxy.com/p/32408.html

上一篇: 403禁止在nginx +乘客+ sinatra

下一篇: 搭乘铁轨的nginx红宝石找不到意见