summaryrefslogtreecommitdiff
path: root/zenwrite/nginx.conf
diff options
context:
space:
mode:
Diffstat (limited to 'zenwrite/nginx.conf')
-rw-r--r--zenwrite/nginx.conf40
1 files changed, 40 insertions, 0 deletions
diff --git a/zenwrite/nginx.conf b/zenwrite/nginx.conf
new file mode 100644
index 0000000..b0223ae
--- /dev/null
+++ b/zenwrite/nginx.conf
@@ -0,0 +1,40 @@
+server {
+ listen 80;
+ server_name zenwrite.example.com;
+ root /var/www/zenwrite/dist;
+ index index.html;
+
+ gzip on;
+ gzip_types text/css application/javascript application/wasm;
+ gzip_min_length 256;
+ gzip_static on;
+
+ # WASM files are large; aggressive cache for fingerprinted assets
+ location ~* \.(wasm)$ {
+ add_header Cross-Origin-Opener-Policy "same-origin";
+ add_header Cross-Origin-Embedder-Policy "require-corp";
+ types { application/wasm wasm; }
+ expires 1y;
+ add_header Cache-Control "public, immutable";
+ }
+
+ location ~* \.(js)$ {
+ expires 1y;
+ add_header Cache-Control "public, immutable";
+ }
+
+ location ~* \.(css|png|jpg|jpeg|gif|ico|svg|ttf|woff2?)$ {
+ expires 1y;
+ add_header Cache-Control "public, immutable";
+ }
+
+ # index.html must never be cached so new builds are picked up
+ location = /index.html {
+ expires -1;
+ add_header Cache-Control "no-cache";
+ }
+
+ location / {
+ try_files $uri $uri/ /index.html;
+ }
+}