繁体   English   中英

如何使用 Apache 2 在 AWS-EC2 Ubuntu Linux 中更改部署中的根路径?

[英]How to change root path in deployment in AWS-EC2 Ubuntu Linux using Apache 2?

一旦我们将我们的 Rails 应用程序部署到 AWS-EC2,但是当我们这样做时,我们的路由就完全出问题了。 Rails 希望 www.example.com/ 成为根。 我们希望 www.example.com/myapp 成为 rails 根路径。

路线

Rails.application.routes.draw do


  resources :forms do
    collection do
      post :accept_item
    end
  end
  resources :stores, m:'true'
  match '/send_mail', to: 'stores#send_mail', via: 'post'
  get 'products' => 'products#index', m:'true'
  get 'stores' => 'stores#index', m:'true'
  get 'transactions' => 'transactions#index', m:'true'
  get 'inventories' => 'inventories#index', m:'true'
  get 'about' => 'sites#about'
  get 'man' => 'sites#index', m:'true'
  root 'sites#index'

end

为什么不将路由文件中的所有路由都包装在一个范围内,例如:

scope path: '/myapp' do
  #routes here
end 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM