瀏覽器緩存
客戶端無緩存的狀況下html
客戶端有緩存的狀況下nginx
校驗過時機制瀏覽器
本地客戶端會檢查Cache-Control(max-age)緩存是否過時,(max-age)爲過時時間緩存
Last-Modified服務器
ETagapp
請求原理url
配置語法-expiresspa
添加Cache-Control、Expires頭.net
Syntax:expires [modified] time;3d
expires epoch |max|off;
Default:expires off;
Context:http,server,location,if in location
Cache-Control:max-age=0表示每次請求都跟服務器校驗Last-Modified
配置語法-expires演示
將配置語法加進去
檢查語法後,重啓nginx,訪問地址http://192.168.96.188/test_expires.html
這時候頭部信息Cache-Control:max-age=86400表示86400秒跟服務器校驗Last-Modified