Laravel Glide-404访问图像:NGINX缓存问题 [英] Laravel Glide - 404 Accessing Images: NGINX Cache Issue
问题描述
在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屋!