在我的生产服务器上,Rails 3.1.0上的图像和资产不起作用 [英] Images and assets not working in my production server on rails 3.1.0

查看:35
本文介绍了在我的生产服务器上,Rails 3.1.0上的图像和资产不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将服务器切换到生产环境,无法加载任何图像.在开发模式下一切正常,但是当我切换到生产环境时,所有功能都停止工作了,我启用了server_static_assets,但仍然没有任何效果.这样做的任何帮助

I switched my server to production and i cannot get any of my images to load. It all works fine on development mode but when i switched to production it all stopped working i have enabled server_static_assets and still yet nothing works. Any help towards doing this

推荐答案

以下是您可能遇到的一些问题:

Here are a few problems that you might be having:

1-您的生产配置可能不正确.如果您从3.1早期版本的候选版本开始并且一直在进行更新,则这种情况尤其可能发生.在rc4和3.1.0版本之间,为production.rb建议的选项发生了很大变化.

1 - Your production configuration may not be correct. This is particularly likely if you started out with an early 3.1 release candidate, and have been updating along the way. The suggested options for production.rb changed quite a bit between rc4 and the 3.1.0 release.

确保您的production.rb设置包括:

Make sure that your production.rb settings include:

# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
# Generate digests for assets URLs
config.assets.digest = true

2-您可能忘记了预编译资产

2 - You may have forgotten to precompile your assets

RAILS_ENV=production rake assets:precompile

3-您可能忘记了重新启动Web服务器来获取production.rb中的更改.

3 - You may have forgotten to restart your web server to pick up the changes in production.rb.

这篇关于在我的生产服务器上,Rails 3.1.0上的图像和资产不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆