figcraft: wasm mime + gzip + cache
Browse files- nginx.conf +27 -42
nginx.conf
CHANGED
|
@@ -1,52 +1,37 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
|
| 5 |
-
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
| 11 |
|
| 12 |
-
|
| 13 |
-
proxy_temp_path /tmp/nginx-proxy;
|
| 14 |
-
fastcgi_temp_path /tmp/nginx-fastcgi;
|
| 15 |
-
uwsgi_temp_path /tmp/nginx-uwsgi;
|
| 16 |
-
scgi_temp_path /tmp/nginx-scgi;
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
}
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
add_header Content-Type text/plain;
|
| 30 |
-
return 200 'ok';
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
location = / {
|
| 34 |
-
return 302 /vnc.html?autoconnect=1&resize=scale&path=websockify;
|
| 35 |
-
}
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
proxy_set_header Host $host;
|
| 43 |
-
proxy_buffering off;
|
| 44 |
-
proxy_read_timeout 3600s;
|
| 45 |
-
proxy_send_timeout 3600s;
|
| 46 |
-
}
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
}
|
| 51 |
}
|
| 52 |
}
|
|
|
|
| 1 |
+
server {
|
| 2 |
+
listen 7860;
|
| 3 |
+
server_name _;
|
| 4 |
|
| 5 |
+
root /usr/share/nginx/html;
|
| 6 |
+
index index.html;
|
| 7 |
|
| 8 |
+
# 18 MiB wasm -> ~7 MiB on the wire.
|
| 9 |
+
gzip on;
|
| 10 |
+
gzip_comp_level 6;
|
| 11 |
+
gzip_min_length 1024;
|
| 12 |
+
gzip_types text/plain text/css application/javascript application/json application/wasm;
|
| 13 |
|
| 14 |
+
add_header X-Content-Type-Options nosniff;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
location = /index.html {
|
| 17 |
+
add_header Cache-Control "no-cache";
|
| 18 |
+
add_header X-Content-Type-Options nosniff;
|
| 19 |
}
|
| 20 |
|
| 21 |
+
# Browsers refuse to stream-compile wasm under any other type.
|
| 22 |
+
location ~ \.wasm$ {
|
| 23 |
+
default_type application/wasm;
|
| 24 |
+
add_header Cache-Control "public, max-age=31536000, immutable";
|
| 25 |
+
add_header X-Content-Type-Options nosniff;
|
| 26 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
+
location ~ \.js$ {
|
| 29 |
+
default_type text/javascript;
|
| 30 |
+
add_header Cache-Control "public, max-age=31536000, immutable";
|
| 31 |
+
add_header X-Content-Type-Options nosniff;
|
| 32 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
+
location / {
|
| 35 |
+
try_files $uri $uri/ /index.html;
|
|
|
|
| 36 |
}
|
| 37 |
}
|