【发布时间】:2016-04-22 11:12:02
【问题描述】:
我已将我的 rails 项目部署到 AWS。我在Gemfile 中有关注:
group :development do
gem 'capistrano'
gem 'capistrano3-puma'
gem 'capistrano-rails', '~> 1.1'
gem 'capistrano-bundler', require: false
gem 'capistrano-rvm'
end
在我的production.rb
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
config.assets.compile = true
config.assets.digest = true
但是,当我在 Web 浏览器中加载我的应用程序时,我在控制台中看到我的 application-xxxxxx.css 和 application-xxxxxx.js 给出了 404 not found 错误。此外,当我去服务器并在 public/assets/ 文件夹中查找文件时,application-xxxxxx.js 存在于那里。
谁能帮我解决这个问题?
【问题讨论】:
-
我能看到的唯一日志是
<html> <head><title>404 Not Found</title></head> <body bgcolor="white"> <center><h1>404 Not Found</h1></center> <hr><center>nginx/1.4.6 (Ubuntu)</center> </body> </html>for application-xxxxxxx.css -
您是否运行了 bundle exec rake assets:precompile??部署后
-
我不需要这样做,因为服务器中的资产已经在 public/assets/application-xxxxxx.js 和 css 中可见。 Capistrano 正在这样做。
标签: ruby-on-rails assets capistrano3 puma