【问题标题】:How to change root path in deployment in AWS-EC2 Ubuntu Linux using Apache 2?如何使用 Apache 2 在 AWS-EC2 Ubuntu Linux 中更改部署中的根路径?
【发布时间】:2017-01-25 00:21:09
【问题描述】:

一旦我们将 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

【问题讨论】:

  • 您能否也为上述应用粘贴您的 apache 配置文件?

标签: ruby-on-rails apache amazon-web-services amazon-ec2


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 2021-11-28
    • 1970-01-01
    • 1970-01-01
    • 2019-06-01
    • 2019-04-04
    • 2012-09-05
    • 2014-11-09
    • 2012-12-09
    • 1970-01-01
    相关资源
    最近更新 更多