Rails 3.1では、アセットパイプラインの処理方法が変更され、プロダクションに配備する際に問題が発生しています。
私はApacheとPassengerを使用していますが、うまくいくようです。
私の制作はこれのように設定されています(今のところ)。
# congif/environments/production.rb
config.cache_classes = false
config.consider_all_requests_local = true
config.action_controller.perform_caching = true
config.serve_static_assets = false
config.assets.compress = true
config.assets.compile = false
config.assets.digest = true
config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
rake資産を実行する:Ubuntuでプリコンパイルしてサーバを起動する。そして...何もない。私のイメージは読み込まれません。
伝説の「このURLで画像を見つけることができません」ボックス。
私はrakeアセットを実行します:CenにSでプリコンパイルしてサーバを起動します。そして...許可エラー。
*Error Compiling CSS Asset*
Errno::EACCESS: Permission Denied - [app path]/tmp/cache/assets/E95
[path に RVM Ruby]/fileutils.rb:243:in 'mkdir'
私はそれを動かすことができません。どんな助けでも大歓迎です。ありがとうございました!
更新
このソリューションは毎回私のために働いています:
最初にあなたの資産を浄化する
rm -rf public/assets
そして
rake assets:clean RAILS_ENV=production
次に、#production.rbの変更で
config.assets.compile = false
に
config.assets.compile = true
Third, run に precompile your assets
rake assets:precompile RAILS_ENV=production
第4に、#production.rbの変更で
config.assets.compile = true
back に
config.assets.compile = false
第5に、次のコマンドを実行してサーバーを再起動します。
にuch tmp/restart.txt
Sixth, un-restrict permissions on your newly created assets by running this commそして
chmod -R 777 public/assets
7つめ、お祝いください!