相关疑难解决方法(0)

为什么nginx找不到我的资产?

我在rails 3.2上,我的生产设置是使用nginx和unicorn.

我有一些资产,一个名为sidekiq的红宝石宝石使用.但是,当我提出要求时,这些资产没有得到妥善处理.我的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; …
Run Code Online (Sandbox Code Playgroud)

assets ruby-on-rails nginx unicorn

4
推荐指数
1
解决办法
3474
查看次数

标签 统计

assets ×1

nginx ×1

ruby-on-rails ×1

unicorn ×1