【问题标题】:Rails 4.2 + NGINX - application root won't loadRails 4.2 + NGINX - 应用程序根目录不会加载
【发布时间】:2014-10-14 05:09:55
【问题描述】:

我的服务器设置适用于 Rails 4.0 应用程序,但在 4.2 应用程序上失败。我收到此错误:

An error occurred.

Sorry, the page you are looking for is currently unavailable.
Please try again later.

If you are the system administrator of this resource then you should check the error log for details.

NGINX 配置:

server {
    listen       80;
    server_name  localhost;
    passenger_enabled on;
    rails_env production;
    root /home/deploy/myapp/current/public;
}

NGINX 错误日志:

2014/10/13 16:17:06 [error] 9261#0: *9 upstream prematurely closed connection while reading response header from upstream, client: ***.***.***.***, server: localhost, request: "GET / H$

Rails 生产日志:

W, [2014-10-13T16:11:57.305892 #10891]  WARN -- : Warning. Error encountered while saving cache a4b17298d22d34199795f642dc5b96ec8d58cc6c/orders.css.scssc: can't dump anonymous class #<$

W, [2014-10-13T16:11:57.314170 #10891]  WARN -- : Warning. Error encountered while saving cache a4b17298d22d34199795f642dc5b96ec8d58cc6c/pages.css.scssc: can't dump anonymous class #<C$

W, [2014-10-13T16:11:57.319744 #10891]  WARN -- : Warning. Error encountered while saving cache a4b17298d22d34199795f642dc5b96ec8d58cc6c/registrations.css.scssc: can't dump anonymous c$

如果我手动将 index.html 文件放入公共目录中,我可以看到。但是当我想转到应用程序的根路径时它失败了。有什么想法吗?

【问题讨论】:

    标签: nginx ruby-on-rails-4.2


    【解决方案1】:

    好吧,这有点尴尬。为了进一步解决我的应用程序问题,我在本地计算机上以生产模式启动,当我加载应用程序时,网页上出现以下错误:

    Missing `secret_key_base` for 'production' environment, set this value in `config/secrets.yml`
    

    原来如此。我想我是直接从 Rails 4.0 跳到 4.2 错过了这个新的安全功能。不知道为什么它没有显示在日志中,但至少我最终找到了它。

    【讨论】:

    • 这几乎每次都发生在我身上!一个好的错误页面会比一个无声的失败更好......
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-05-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-01
    • 1970-01-01
    相关资源
    最近更新 更多