我使用Capistrano 2,Unicorn,Nginx部署了我的RoR 4应用程序.
问题是我获得404资产(样式表,javascripts).
这是Nginx访问日志:
89.0.40.233 - - [16/Mar/2014:08:24:26 +0000] "GET /stylesheets/application.css HTTP/1.1" 404 650 "http://host.cloudapp.net/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/33.0.1750.149 Safari/537.36"
89.0.40.233 - - [16/Mar/2014:08:24:26 +0000] "GET /javascripts/application.js HTTP/1.1" 404 650 "http://host.cloudapp.net/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/33.0.1750.149 Safari/537.36"
我的资源位于app文件夹中:
azureuser@host:~/apps/testify/current/public$ls -a assets
. application-d65a0eaefe6ca2eef9400045f94ab52b.js
.. application-d65a0eaefe6ca2eef9400045f94ab52b.js.gz
application-71e2591e9586afebf3fb4ff70aaae199.css manifest-a348973e84698f7d898e8021bd6e5388.json
application-71e2591e9586afebf3fb4ff70aaae199.css.gz
我的Nginx配置:
upstream unicorn {
server unix:/tmp/unicorn.testify.sock fail_timeout=0;
}
server {
listen 80 default deferred;
root /home/azureuser/apps/testify/current/public;
location ^~ /assets/ {
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;
}
我从哪里开始看?@H_404_29@