【发布时间】:2015-03-20 18:24:06
【问题描述】:
我的 Rails 4 应用程序在开发模式下运行,但在生产中我只看到一个空白页面。
它在 CentOS 7 VPS 中运行带有 Nginx 的 Unicorn。
任何提示我需要什么?
unicorn_rails -c config/unicorn.rb -D
unicorn_rails -c config/unicorn.rb -D -E production
Nginx、Unicorn 和 Rails 的日志没有显示任何错误。
耙路线
[root@mycentos my_app]# rake 路由
Prefix Verb URI Pattern Controller#Action
blogs GET /blogs(.:format) blogs#index
POST /blogs(.:format) blogs#create
new_blog GET /blogs/new(.:format) blogs#new
edit_blog GET /blogs/:id/edit(.:format) blogs#edit
blog GET /blogs/:id(.:format) blogs#show
PATCH /blogs/:id(.:format) blogs#update
PUT /blogs/:id(.:format) blogs#update
DELETE /blogs/:id(.:format) blogs#destroy
在开发中我可以正常访问任何路由,即使当路由不存在时它也会显示错误消息。但在生产中,始终是空白。
【问题讨论】:
-
如果您在生产服务器上运行 rake 路由,输出或错误是什么?
-
而且,您是否在上传和部署之前运行了 $ rake assets:precompile RAILS_ENV = production
-
不,我之前没有运行过它。应用是在同一个VPS中生成的,不是上传的。
-
运行 rake assets 后,我还需要做什么?
-
不确定。需要更多信息。在生产服务器输出上运行“rake routes”有什么作用?
标签: ruby-on-rails nginx unicorn