私が苦労している3つの大きな問題があります。Apacheの下のサブディレクトリにRails 4アプリを設定する
1)Railsアプリケーションをルートとしてmyurl.com/myapp/
に設定するにはどうすればよいですか?
は私がroutes.rb
で試してみました:
scope '/myapp' || '/' do
# all resources and routes go here
root :to => "papers#index"
resources :papers
end
とenvironment.rb
で、私はそのrake routes
を除き、トップ
ENV['RAILS_RELATIVE_URL_ROOT'] = "/myapp"
これは、ほぼ作品にこれを追加するための任意の経路を印刷しません「/ 」、GET myurl.com/myapp/
は、ActionController::RoutingError (No route matches [GET] "/")
2)Apacheに何を伝える必要がありますか?
私の共有サーバーのプロバイダは/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
. $HOME/.bash_profile
# This makes Rails/Rack think we're running under FastCGI. WTF?!
# See ~/.gem/ruby/1.9.1/gems/rack-1.2.1/lib/rack/handler.rb
export PHP_FCGI_CHILDREN=1
# Get into the project directory and start the Rails server
cd $HOME/rails4
exec bundle exec rails server -e production
私は、サイト上の任意のリンクをクリックすると、ブラウザのURLは、例えば変更されて~/html/.htaccess
RewriteEngine on
RewriteRule ^myapp/(.*)$ /fcgi-bin/rails4/$1 [QSA,L]
にこれを置くことを提案しますmyurl.com/fcgi-bin/rails4/papers/1
になります。ここでは、myurl.com/myapp/papers/1
になります。どうすればそれを防ぐことができますか?これは1と一緒に何とか解決されるように私は感じ
作業資産を取得する方法
3))及び2)。しかし、今、アプリは何しようとします:404 Not Found
をprocudes
GET myurl.com/assets/application-5e86fb668d97d38d6994ac8e9c45d45e.css
。資産はサブディレクターの下になければなりません、そうですか?レールを置いてそこに置くようにレールにどのように指示しますか?