nginx根據location的uri進行不同的緩存配置


html不進行緩存,將js和css文件進行緩存配置

 

   location ^~ /abc {
         if ($request_filename ~* .*\.(?:htm|html)$)
         {
             add_header Cache-Control no-store;
         }
         if ($request_filename ~* .*\.(js|css|jpg|jpeg|gif|png|ico)$)
         {
             add_header Cache-Control max-age=2592000,s-maxage=68400;
         }
         alias /data/www/abc/dist/;
         index index.html index.htm;
         try_files $uri $uri/ /index.html;
    }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM