ActionController::RoutingError (没有路由匹配 [GET] "/")

时间:2021-04-28 02:29:37

标签: ruby-on-rails nginx routes puma

我正在使用 rails 6.1.3 和 puma 5 来制作简单的 rails 应用程序。我有books_controller.rb 由脚手架命令生成。我设置了routes.rb

Rails.application.routes.draw do
  resources :books
  root to: 'books#index'
  # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end

它在 http://localhost:3000 上运行良好,但是当我在 EC2 上部署它时,当我从我的 IP xx.xxx.xxx.xx 访问时,浏览器显示消息错误:This xx.xx.xx.xx page can’t be found,并且我检查我的 production.log on rails

ActionController::RoutingError (No route matches [GET] "/")

但如果我尝试xx.xxx.xxx.xx/books,效果很好。请帮我设置路由根。 我检查我的代码是否在 EC2 上更新,因此与本地不同的代码没有问题。

0 个答案:

没有答案
相关问题