Rails公用文件夹重新路由到控制器索引

时间:2015-04-20 20:54:29

标签: ruby-on-rails apache routes

所以我按照DigitalOcean上的这个教程来通过乘客部署rails服务器,不确定我是否正确使用了我的服务器在CentOS 7上。

https://www.digitalocean.com/community/tutorials/how-to-setup-a-rails-4-app-with-apache-and-passenger-on-centos-6

基本上我的问题是,如果我使用http conf将传入流量重定向到应用程序的公共文件夹(/ var / www / html / myapp / public),是否有办法从公用文件夹重定向到说一个控制器的索引?

我已尝试在路径文件中编辑根路由,但我仍然在使用默认的Apache启动页面。 root' testcontroller #index' (不起作用。)

如果您需要更多信息,请与我们联系。 谢谢!

-Edit 4/22 / 15- 粘贴我的routes.rb内容

Rails.application.routes.draw do
  resources :ip_logs

  # The priority is based upon order of creation: first created -> highest priority.
  # See how all your routes lay out with "rake routes".

  # You can have the root of your site routed with "root"
  root 'ip_logs#index'

  # Example of regular route:
  #   get 'products/:id' => 'catalog#view'

  # Example of named route that can be invoked with purchase_url(id: product.id)
  #   get 'products/:id/purchase' => 'catalog#purchase', as: :purchase

  # Example resource route (maps HTTP verbs to controller actions automatically):
  #   resources :products

  # Example resource route with options:
  #   resources :products do
  #     member do
  #       get 'short'
  #       post 'toggle'
  #     end
  #
  #     collection do
  #       get 'sold'
  #     end
  #   end

  # Example resource route with sub-resources:
  #   resources :products do
  #     resources :comments, :sales
  #     resource :seller
  #   end

  # Example resource route with more complex sub-resources:
  #   resources :products do
  #     resources :comments
  #     resources :sales do
  #       get 'recent', on: :collection
  #     end
  #   end

  # Example resource route with concerns:
  #   concern :toggleable do
  #     post 'toggle'
  #   end
  #   resources :posts, concerns: :toggleable
  #   resources :photos, concerns: :toggleable

  # Example resource route within a namespace:
  #   namespace :admin do
  #     # Directs /admin/products/* to Admin::ProductsController
  #     # (app/controllers/admin/products_controller.rb)
  #     resources :products
  #   end
end

我创建了一个名为ip_logs的脚手架。如果我使用rails server -b 0.0.0.0 -p 80运行rails服务器,它将重定向到ip_logs的索引页面。只是想知道如何使用http conf将来自/ public的传入流量重定向到特定控制器的索引页面。

0 个答案:

没有答案