vhost_expires.j2 1.1 KB

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