Laravel Glide-404访问图像:NGINX缓存问题 [英] Laravel Glide - 404 Accessing Images: NGINX Cache Issue

查看:233
本文介绍了Laravel Glide-404访问图像:NGINX缓存问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Laravel 5.1应用程序中,我正在使用 https://github.com/thephpleague/glide调整大小后,可通过.cache目录调整大小并提供图像.我遇到了与 Laravel Glide无法找到图像完全相同的问题在带有扩展名的网址中

Within my Laravel 5.1 app, I'm using https://github.com/thephpleague/glide to resize and serve images via a .cache directory once resized. I am running into the exact same issue as Laravel Glide not finding images at urls with extension

必须禁用NGINX中的缓存:

Have had to disable caching in NGINX:

# cache.appcache, your document html and data
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
  expires -1;
  access_log logs/static.log;
}

# Feed
location ~* \.(?:rss|atom)$ {
  expires 1h;
  add_header Cache-Control "public";
}

# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
  expires 1M;
  access_log off;
  add_header Cache-Control "public";
}

# CSS and Javascript
location ~* \.(?:css|js)$ {
  expires 1y;
  access_log off;
  add_header Cache-Control "public";
}

# WebFonts
# If you are NOT using cross-domain-fonts.conf, uncomment the following directive
location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ {
 expires 1M;
 access_log off;
 add_header Cache-Control "public";
}

禁用这些规则后,我可以再次访问图像.有小费吗?启用此功能后,我仍然可以查看"图像,但是我的服务器无法读取它们.可能在这里发生的事情有些失落.感谢您的帮助!

After disabling these rules I can access the images again. Any tips? I can still "see" the images when enabling this, but my server cannot read them. A little lost on what could be going on here. Thanks for any help!

推荐答案

使用'jpg | jpeg | gif | png |'在您的匹配项之外,重新启动nginx,清除浏览器缓存. Glide会为您的图像整理缓存.

Take 'jpg|jpeg|gif|png|' out of your matches, restart nginx, clear browser cache. Glide will sort the caching out for your images.

这篇关于Laravel Glide-404访问图像:NGINX缓存问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆