add gzip, sitemap caching, favicon glob to nginx
- SHA
8cfbee01d1f464d9825d0af4b63bae2f7ab45540- Parents
-
f7cba1f - Tree
9ac104c
8cfbee0
8cfbee01d1f464d9825d0af4b63bae2f7ab45540f7cba1f
9ac104c| Status | File | + | - |
|---|---|---|---|
| M |
nginx.conf
|
32 | 1 |
nginx.confmodified@@ -15,6 +15,23 @@ server { | ||
| 15 | 15 | add_header X-XSS-Protection "1; mode=block"; |
| 16 | 16 | add_header Referrer-Policy "strict-origin-when-cross-origin"; |
| 17 | 17 | |
| 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 | + | |
| 18 | 35 | # Logging |
| 19 | 36 | access_log /var/log/nginx/tarmac.access.log; |
| 20 | 37 | error_log /var/log/nginx/tarmac.error.log; |
@@ -42,6 +59,20 @@ server { | ||
| 42 | 59 | add_header Cache-Control "public, immutable"; |
| 43 | 60 | } |
| 44 | 61 | |
| 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 | + | |
| 45 | 76 | # Install script - serve directly with correct MIME type |
| 46 | 77 | location = /install.sh { |
| 47 | 78 | alias /var/www/tarmac.musicsian.com/current/public/install.sh; |
@@ -50,7 +81,7 @@ server { | ||
| 50 | 81 | } |
| 51 | 82 | |
| 52 | 83 | # Favicon caching |
| 53 | - location /favicon.ico { | |
| 84 | + location ~ ^/favicon\.(ico|png|svg)$ { | |
| 54 | 85 | proxy_pass http://127.0.0.1:3003; |
| 55 | 86 | expires 1w; |
| 56 | 87 | } |