【问题标题】:chef and nginx not serving rails厨师和 Nginx 不服务 Rails
【发布时间】:2013-10-12 15:55:31
【问题描述】:

我正在尝试让 nginx 为我的 rails 应用程序(有乘客)提供服务,但我得到的只是 index.html

sites-enabled/financeRails 是:

server {
    listen 80;
    server_name finance.mbdev-berkshelf;
    root /srv/www/mbdev.com/public_html/public;
    passenger_enabled on;
    passenger_ruby /opt/rbenv/versions/1.9.3-p448/
}

我可以在日志上看到它工作正常:

10.0.0.1 - - [10/Oct/2013:06:27:33 +0000] "GET / HTTP/1.1" 200 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36"

但我没有得到 rails 应用程序...

请注意,删除 public/index.html 会导致:

directory index of "/srv/www/mbdev.com/public_html/public/" is forbidden

【问题讨论】:

  • 在您的config/routes.rb 中,您是否已将root 更改为指向您希望成为rails 应用程序默认值的controller#action
  • 我认为这与rbenv有关。该应用程序在 apache/rvm 环境中运行良好

标签: ruby-on-rails nginx passenger chef-infra


【解决方案1】:

在您的路线中提到了root :to => "your_index_file_path"

【讨论】:

  • 是的,有根路由,并且应用程序工作正常(在另一个环境中)。在阅读了其他问题后,我意识到这可能与 rbenv/nginx 组合有关
【解决方案2】:

我发现了问题。我正在使用厨师安装 nginx 和乘客。看来,如果在 nginx 之后安装了乘客,它不会在 /etc/nginx/ngninx.conf 中放置正确的属性 - 导致 rails 无法正常工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-06
    • 2013-08-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多