Rails能够在生产中找到一些图像但不能在其他图像中找到

时间:2018-04-08 20:43:32

标签: ruby-on-rails nginx puma

我正在生产Rails,Puma,Nginx和标准的Rails资产管道。出于某种原因,虽然我能够显示一些图像而不是其他图像。

例如,我在/ assets / animations文件夹中有一个显示的两个GIF,另一个是给我一个nginx 404错误。我仔细检查了两个文件都在我的public / assets / animations文件夹中,其中包含正确的名称和相同的文件权限。我无法弄清楚为什么会这样。

Nginx配置

upstream wedding {
    # Path to Puma SOCK file, as defined previously
    server unix:///root/wedding/shared/sockets/puma.sock fail_timeout=0;
}


server {
     listen 80;
     server_name mysite.com www.mysite.com;

     root /root/wedding/public;
     access_log /root/wedding/log/nginx.access.log;
     error_log /root/wedding/log/nginx.error.log;
     index index.html index.htm;

     try_files $uri/index.html $uri @wedding;
     auth_basic off;

     location @wedding {
        proxy_pass http://wedding;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-Url-Scheme $scheme;
        proxy_redirect off;
    }

    location /assets {
        root /root/wedding/public;
    }

    error_page 500 502 503 504 /500.html;
    client_max_body_size 4G;
    keepalive_timeout 10;
}

更新

仔细观察,image_tag生成的文件名和资源编译器生成的文件名不完全相同 -

flowers-3866b270148b6759a9307194ba45164405c7dda926f05587f41dfdeada89b80b.gif
flowers-3866b270148b6759a9307194ba45164405c7dda926f5587f41dfdeada89b80b.gif

最上面一个是assets文件夹中的文件名,底部是image_tag指向的文件名。

0 个答案:

没有答案
相关问题