Laravel Glide - 404 访问图像:NGINX 缓存问题
Laravel Glide - 404 Accessing Images: NGINX Cache Issue
在我的 Laravel 5.1 应用程序中,我正在使用 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 中禁用缓存:
# 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";
}
禁用这些规则后,我可以再次访问图像。有小费吗?启用此功能时我仍然可以 "see" 图片,但我的服务器无法读取它们。对这里可能发生的事情有点迷茫。感谢您的帮助!
将'jpg|jpeg|gif|png|'从你的匹配项中移除,重启nginx,清除浏览器缓存。 Glide 将为您的图像分类缓存。
在我的 Laravel 5.1 应用程序中,我正在使用 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 中禁用缓存:
# 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";
}
禁用这些规则后,我可以再次访问图像。有小费吗?启用此功能时我仍然可以 "see" 图片,但我的服务器无法读取它们。对这里可能发生的事情有点迷茫。感谢您的帮助!
将'jpg|jpeg|gif|png|'从你的匹配项中移除,重启nginx,清除浏览器缓存。 Glide 将为您的图像分类缓存。