ruby-on-rails-乘客nginx:在子目录中托管Rails应用程序

前端之家收集整理的这篇文章主要介绍了ruby-on-rails-乘客nginx:在子目录中托管Rails应用程序 前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我正在尝试按照以下“乘客”文档中的步骤在www.myserver.com下的/ a子目录中部署应用程序:
http://www.modrails.com/documentation/Users%20guide.html#deploying_rails_to_sub_uri

这似乎可行,但是Rails路由现在都希望有附加的子目录/ a,因此尝试访问根www.myserver.com/a会给我一个RoutingError.我试过设置relative_url_root,但这没有任何改变.我需要在路由文件中的每条路由上添加前缀/ a吗?

最佳答案
嗯…一切似乎对我来说都很好.刚刚尝试过.

您确定遵循Nginx指令而不是Apache指令吗?

确保您进行了软链接并更改了“ root”应用程序……说明中指出要使其成为绝对路径减去“ public”部分:

http {
    …

  1. server {
  2. listen 80;
  3. server_name g.local;
  4. root /home/bernie/development/test; <- forgot to change this the first time I tried
  5. passenger_enabled on;
  6. passenger_base_uri /rails;
  7. }
  8. ...

}

这是最终结果的图像…无需修改路由:

alt text http://img190.imageshack.us/img190/8898/32380822.png

这是Nginx的说明:

http://www.modrails.com/documentation/Users%20guide%20Nginx.html#deploying_rails_to_sub_uri

猜你在找的Nginx相关文章