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