资产/图像中的图像/未显示在AWS Elastic Beanstalk实例中

时间:2017-01-27 16:46:03

标签: ruby-on-rails elastic-beanstalk

我的RoR应用中的app / assets / images /文件夹中有一些资源。这些图像在我的本地环境中可以作为/assets/image.png使用,它们在我部署到Heroku时使用(使用作为测试环境),但是应用程序现在在AWS上运行(Elastic Beanstalk)并且图像资产给了我一个404. css和js文件工作正常,只有图像文件不起作用。下面是相关的production.rb - 应该注意的是,production.rb(在AWS上运行 - 图像不起作用)和test.rb(在Heroku上运行 - 图像确实有效)完全相同。

production.rb

config.eager_load = true

# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local       = false
config.action_controller.perform_caching = true

# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass

# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = true
config.assets.precompile =  ['*.js', '*.css', '*.css.erb']

0 个答案:

没有答案