vhost_expires.j2 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. {% if ansible_controlled is defined and ansible_controlled != "" %}
  2. #
  3. # {{ ansible_controlled }}
  4. #
  5. {% endif %}
  6. #
  7. # Expirerules for static content
  8. #
  9. # cache.appcache, your document html and data
  10. location ~* \.(?:manifest|appcache|html?|xml|json)$ {
  11. expires -1;
  12. }
  13. # Feeds
  14. location ~* \.(?:rss|atom)$ {
  15. expires 1h;
  16. add_header Cache-Control "public";
  17. add_header X-Content-Type-Options "nosniff";
  18. }
  19. # Media: images, icons, video, audio, HTC
  20. location ~* \.(?:jpg|jpeg|webp|gif|png|ico|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
  21. expires 1M;
  22. access_log off;
  23. add_header Cache-Control "public";
  24. add_header X-Content-Type-Options "nosniff";
  25. }
  26. # Web fonts
  27. location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ {
  28. expires 1M;
  29. access_log off;
  30. add_header Cache-Control "public";
  31. add_header "Access-Control-Allow-Origin" "*";
  32. add_header X-Content-Type-Options "nosniff";
  33. }
  34. # CSS and Javascript
  35. location ~* \.(?:css|js)$ {
  36. expires 2M;
  37. access_log off;
  38. add_header Cache-Control "public";
  39. add_header X-Content-Type-Options "nosniff";
  40. }