vhost_expires.j2 859 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. }
  17. # Media: images, icons, video, audio, HTC
  18. location ~* \.(?:jpg|jpeg|gif|png|ico|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
  19. expires 1M;
  20. access_log off;
  21. add_header Cache-Control "public";
  22. }
  23. # Web fonts
  24. location ~* \.(?:ttf|ttc|otf|eot|woff)$ {
  25. expires 1M;
  26. access_log off;
  27. add_header Cache-Control "public";
  28. add_header "Access-Control-Allow-Origin" "*";
  29. }
  30. # CSS and Javascript
  31. location ~* \.(?:css|js)$ {
  32. expires 2M;
  33. access_log off;
  34. add_header Cache-Control "public";
  35. }