lljz66 commited on
Commit
6a859ca
·
verified ·
1 Parent(s): 5d94a52

figcraft: wasm mime + gzip + cache

Browse files
Files changed (1) hide show
  1. nginx.conf +27 -42
nginx.conf CHANGED
@@ -1,52 +1,37 @@
1
- worker_processes 1;
2
- error_log /dev/stderr warn;
3
- pid /tmp/nginx.pid;
4
 
5
- events { worker_connections 1024; }
 
6
 
7
- http {
8
- include /etc/nginx/mime.types;
9
- default_type application/octet-stream;
10
- access_log off;
 
11
 
12
- client_body_temp_path /tmp/nginx-body;
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
- map $http_upgrade $connection_upgrade {
19
- default upgrade;
20
- '' close;
21
  }
22
 
23
- server {
24
- listen 7860;
25
- server_name _;
26
- root /usr/share/novnc;
27
-
28
- location = /healthz {
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
- location /websockify {
38
- proxy_pass http://127.0.0.1:5901/;
39
- proxy_http_version 1.1;
40
- proxy_set_header Upgrade $http_upgrade;
41
- proxy_set_header Connection $connection_upgrade;
42
- proxy_set_header Host $host;
43
- proxy_buffering off;
44
- proxy_read_timeout 3600s;
45
- proxy_send_timeout 3600s;
46
- }
47
 
48
- location / {
49
- try_files $uri $uri/ =404;
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
  }