Browse Source

Tiny imporvements in Nginx default configuration

Emmanuel Bouthenot 11 years ago
parent
commit
55294d6db7

+ 1 - 0
roles/webserver/templates/nginx/nginx.conf.j2

@@ -103,6 +103,7 @@ http {
     gzip_types
         application/atom+xml
         application/javascript
+        application/x-javascript
         application/json
         application/rss+xml
         application/vnd.ms-fontobject

+ 1 - 1
roles/webserver/templates/nginx/vhost_all.j2

@@ -3,6 +3,6 @@
 {{ prolog() }}
 {% endif -%}
 
-include /etc/nginx/vhost_cache-fd;
 include /etc/nginx/vhost_expires;
+include /etc/nginx/vhost_cache-fd;
 include /etc/nginx/vhost_protect-files;

+ 8 - 0
roles/webserver/templates/nginx/vhost_expires.j2

@@ -24,6 +24,14 @@ location ~* \.(?:jpg|jpeg|gif|png|ico|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
   add_header Cache-Control "public";
 }
 
+# Web fonts
+location ~* \.(?:ttf|ttc|otf|eot|woff)$ {
+    expires 1M;
+    access_log off;
+    add_header Cache-Control "public";
+    add_header "Access-Control-Allow-Origin" "*";
+}
+
 # CSS and Javascript
 location ~* \.(?:css|js)$ {
   expires 2M;