私は Rails 3.2 を使用しており、本番環境では nginx と unicorn を使用しています。
sidekiq と呼ばれる ruby gem が使用するいくつかのアセットに問題があります。しかし、これらのアセットはリクエストしても適切に提供されません。私のnginx設定は次のようになります:
upstream unicorn {
server unix:/tmp/unicorn.myapp.sock fail_timeout=0;
}
server {
listen 80 default deferred;
# server_name example.com;
root /home/deployer/apps/myapp/current/public;
if (-f $document_root/system/maintenance.html) {
return 503;my
}
error_page 503 @maintenance;
location @maintenance {
rewrite ^(.*)$ /system/maintenance.html last;
break;
}
location ~ ^/assets/ {
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;
if (-f $document_root/system/maintenance.html) {
return 503;
}
error_page 503 @maintenance;
location @maintenance {
rewrite ^(.*)$ /system/maintenance.html last;
break;
}
}
私のブラウザから、
たとえば requestingであることがわかりhttp://www.myapp.com/admin/sidekiq/stylesheets/application.css
ます。
サーバーにsshして次のように書くと:
ls /home/deployer/apps/myapp/current/public/admin/sidekiq/stylesheets
application.css bootstrap.css
実際にあることがわかります。では、なぜ提供されていないのでしょうか。