danangds

Cache browser untuk nginx

Jul 20th, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.54 KB | None | 0 0
  1. #expires header, access log off, log not found off for static files
  2. #file yang di cache browser 31 hari
  3. location ~* \.(css|js|gif|ico|webp|ttf|ttc|eot|woff|woff2|otf|svg)$ {
  4.     expires 31d;
  5.        
  6.     log_not_found off;
  7.     access_log off;
  8. }
  9. #file yang tidak boleh di cache browser
  10. location ~* \.(txt|xml|xsl)$ {
  11.     if_modified_since off;
  12.     add_header Last-Modified  "";
  13.  
  14.     add_header Cache-Control "no-cache, no-store, max-age=0, must-revalidate";
  15.     add_header Expires "Mon, 01 Jan 1990 00:00:00 GMT";
  16.     etag off;
  17.     log_not_found off;
  18.     access_log off;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment