我正在努力解决三个主要问题,我感谢任何帮助.
1)如何配置Rails应用程序myurl.com/myapp/
作为根?
我试过routes.rb
:
scope '/myapp' || '/' do
# all resources and routes go here
root :to => "papers#index"
resources :papers
end
Run Code Online (Sandbox Code Playgroud)
在environment.rb
,我把它添加到顶部
ENV['RAILS_RELATIVE_URL_ROOT'] = "/myapp"
Run Code Online (Sandbox Code Playgroud)
这几乎可以工作,除了rake routes
不打印"/"的任何路径,并GET myurl.com/myapp/
产生ActionController::RoutingError (No route matches [GET] "/")
2)告诉apache需要什么?
我的共享服务器的提供商建议将其添加到 ~/html/.htaccess
RewriteEngine on
RewriteRule ^myapp/(.*)$ /fcgi-bin/rails4/$1 [QSA,L]
Run Code Online (Sandbox Code Playgroud)
与/fcgi-bin/rails4
存在
#!/bin/sh
# This is needed to find gems installed with --user-install
export HOME=/home/kadrian
# Include our profile to include the right RUBY
. …
Run Code Online (Sandbox Code Playgroud) apache deployment ruby-on-rails subdirectory ruby-on-rails-4