[英]Laravel Glide - 404 Accessing Images: NGINX Cache Issue
在我的Laravel 5.1應用程序中,我使用https://github.com/thephpleague/glide調整大小並在調整大小后通過.cache
目錄提供圖像。 我遇到了與Laravel Glide完全相同的問題, 無法在帶有擴展名的網址中找到圖像
必須禁用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";
}
禁用這些規則后,我可以再次訪問圖像。 有小費嗎? 啟用此功能后,我仍然可以“查看”圖像,但是我的服務器無法讀取它們。 可能在這里發生的事情有些失落。 謝謝你的幫助!
以“ jpg | jpeg | gif | png |” 在您的匹配項之外,重新啟動nginx,清除瀏覽器緩存。 Glide會為您的圖像整理緩存。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.