0

我们在生产()服务器上ruby 2.0.0-p0使用passenger 4.0.0rcnginx/1.2.7)运行。请注意,我们的 nginx.conf 中的 没有指向基本子目录。相反,它什么也不返回。这是在 nginx.conf 中:ubuntu 12.04rails 3.2.12passenger_base_uripassenger_base_uri

server {
  listen 80;
  server_name 154.49.55.6;
  root /ebs/www/;
  passenger_enabled on;
  rails_env production;
  passenger_base_uri /nbhy;

  #for rails >= 3.1, assets pipeline
  location ~ ^/assets/ {
    expires max;
    add_header Cache-control public;
    add_header ETag "";
    break;
  }
}

Asymlink nbhy在 /ebs/www 下的服务器上创建并指向/ebs/www/nbhyop/current/public. 这/nbhy是 rails 应用程序的基本 uri。

这里是nginx error log

[ 2013-05-06 17:47:00.5469 718/7f5097fc0700 Pool2/Implementation.cpp:1098 ]: [App 838 stdout]
2013/05/06 17:47:26 [error] 735#0: *104 open() "/ebs/www/authentify/session" failed (2: No such file or directory), client: 6.5.5.94, server: 154.49.55.6, request: "POST /authentify/session HTTP/1.1", host: "154.49.55.6", referrer: "http://154.49.55.6/nbhy/signin"

上面的路径应该是:/ebs/www/nbhy/authentify/session 而不是 /ebs/www/authentify/session。

相同的配置适用于乘客 3.x。如何解决这个问题?感谢帮助

4

1 回答 1

1

I believe you were using passenger_base_uri for the wrong purpose. By specifying passenger_base_uri, you are saying:

"I have another web app, living under /nbhy"

I see in the Nginx output that you were doing a POST /authentify/session. Since you are not accessing any URL under /nbhy, the passenger_base_uri option has no effect. If you POST /nbhy/authentify/session, then it'll have effect.

Perhaps you want to set the virtual host's root to /ebs/www/nbhyop/current/public?

于 2013-05-18T07:20:20.797 回答