gardesk/tarmac-web / 8cfbee0

Browse files

add gzip, sitemap caching, favicon glob to nginx

Authored by espadonne
SHA
8cfbee01d1f464d9825d0af4b63bae2f7ab45540
Parents
f7cba1f
Tree
9ac104c

1 changed file

StatusFile+-
M nginx.conf 32 1
nginx.confmodified
@@ -15,6 +15,23 @@ server {
1515
     add_header X-XSS-Protection "1; mode=block";
1616
     add_header Referrer-Policy "strict-origin-when-cross-origin";
1717
 
18
+    # Gzip compression
19
+    gzip on;
20
+    gzip_vary on;
21
+    gzip_proxied any;
22
+    gzip_comp_level 6;
23
+    gzip_min_length 256;
24
+    gzip_types
25
+        text/plain
26
+        text/css
27
+        text/xml
28
+        text/javascript
29
+        application/json
30
+        application/javascript
31
+        application/xml
32
+        application/rss+xml
33
+        image/svg+xml;
34
+
1835
     # Logging
1936
     access_log /var/log/nginx/tarmac.access.log;
2037
     error_log /var/log/nginx/tarmac.error.log;
@@ -42,6 +59,20 @@ server {
4259
         add_header Cache-Control "public, immutable";
4360
     }
4461
 
62
+    # Sitemap and robots.txt — cache briefly, serve fast
63
+    location = /sitemap.xml {
64
+        proxy_pass http://127.0.0.1:3003;
65
+        proxy_http_version 1.1;
66
+        proxy_set_header Host $host;
67
+        expires 1d;
68
+        add_header Cache-Control "public";
69
+    }
70
+
71
+    location = /robots.txt {
72
+        alias /var/www/tarmac.musicsian.com/current/public/robots.txt;
73
+        expires 1w;
74
+    }
75
+
4576
     # Install script - serve directly with correct MIME type
4677
     location = /install.sh {
4778
         alias /var/www/tarmac.musicsian.com/current/public/install.sh;
@@ -50,7 +81,7 @@ server {
5081
     }
5182
 
5283
     # Favicon caching
53
-    location /favicon.ico {
84
+    location ~ ^/favicon\.(ico|png|svg)$ {
5485
         proxy_pass http://127.0.0.1:3003;
5586
         expires 1w;
5687
     }