我通过Capistrano将启用了资产管道的Rails 3.2.8应用程序部署到我的Linode服务器.它正在运行nginx独角兽.当我访问我的应用程序时,虽然资产存在于 RAILS_DIR / public / assets中,但是最小化的JS和CSS没有被提供....

我通过Capistrano将启用了资产管道的Rails 3.2.8应用程序部署到我的Linode服务器.
它正在运行nginx独角兽.
当我访问我的应用程序时,虽然资产存在于< RAILS_DIR> / public / assets中,但是最小化的JS和CSS没有被提供.
$tree assets
assets
|-- application-66e477d6fd8cf088e8be44affeead089.css
|-- application-66e477d6fd8cf088e8be44affeead089.css.gz
|-- application-7d3ead38a0b5e276a97d48e52044ac31.js
|-- application-7d3ead38a0b5e276a97d48e52044ac31.js.gz
在我的应用程序中,我可以看到找不到那些确切的文件:
这是我的nginx配置:
server {
listen 80 default deferred;
server_name me.example.com;
root /home/kennym/apps/app/current/public;
location ^~ /assets/ {
add_header Last-Modified "";
add_header ETag "";
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @unicorn;
location @unicorn {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://unicorn;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
你能猜出出了什么问题吗?
解决方法:
位置^?/ assets /应该是位置?^ / assets /.
前者与/ assets /不匹配,后者匹配以/ assets /开头的模式
更新您的nginx配置以获得缓存和预先gzipped文件服务再次工作.
沃梦达教程
本文标题为:ruby-on-rails – Rails / Nginx不提供JS和CSS


基础教程推荐
猜你喜欢
- 汇编语言:比较指令、跳转指令、JCC的使用 2023-07-06
- R语言入门使用RStudio制作包含Rcpp代码的R包 2022-12-05
- 详解swift中xcworkspace多项目管理 2023-07-05
- R语言向量下标和子集的使用 2022-12-10
- 解决R语言中install_github中无法安装遇到的问题 2022-11-26
- ruby – 如何使用Nginx,Passenger,Sinatra创建多个位置 2023-09-20
- R语言因子型数值转数值型的操作 2022-11-23
- 如何将mysql数据库文件连接到Rails应用程序上的本地ruby 2023-09-21
- 深入探究Golang中log标准库的使用 2023-07-25
- R语言的一个加法函数使用介绍 2022-11-14