Bfjandak commited on
Commit
25ebc92
·
verified ·
1 Parent(s): 1724815

Create nginx.conf

Browse files
Files changed (1) hide show
  1. nginx.conf +86 -0
nginx.conf ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ worker_processes auto;
2
+ pid /tmp/nginx.pid;
3
+
4
+ events {
5
+ worker_connections 1024;
6
+ }
7
+
8
+ http {
9
+ include /etc/nginx/mime.types;
10
+ default_type application/octet-stream;
11
+
12
+ # --- Kernel Static Serving Performance Optimizations ---
13
+ sendfile on;
14
+ tcp_nopush on;
15
+ tcp_nodelay on;
16
+ keepalive_timeout 65;
17
+
18
+ # --- Production Gzip Compression Matrix ---
19
+ gzip on;
20
+ gzip_vary on;
21
+ gzip_proxied any;
22
+ gzip_min_length 1024;
23
+ gzip_comp_level 5;
24
+ gzip_types
25
+ text/plain
26
+ text/css
27
+ text/xml
28
+ image/svg+xml
29
+ application/javascript
30
+ application/x-javascript
31
+ application/json
32
+ application/xml
33
+ application/xml+rss;
34
+
35
+ # --- Rootless Unprivileged Temp Write Paths ---
36
+ client_body_temp_path /tmp/client_temp;
37
+ proxy_temp_path /tmp/proxy_temp;
38
+ fastcgi_temp_path /tmp/fastcgi_temp;
39
+ uwsgi_temp_path /tmp/uwsgi_temp;
40
+ scgi_temp_path /tmp/scgi_temp;
41
+
42
+ server {
43
+ listen 8080;
44
+ server_name localhost;
45
+ root /usr/share/nginx/html;
46
+
47
+ # --- Adjusted Cross-Origin Integration Hardening Headers ---
48
+ add_header X-Frame-Options "SAMEORIGIN" always;
49
+ add_header X-Content-Type-Options "nosniff" always;
50
+ add_header Referrer-Policy "strict-origin-when-cross-origin" always;
51
+ add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
52
+ add_header Cross-Origin-Opener-Policy "same-origin-allow-popups" always;
53
+ add_header Cross-Origin-Resource-Policy "cross-origin" always;
54
+ add_header X-Permitted-Cross-Domain-Policies "none" always;
55
+ add_header X-Download-Options "noopen" always;
56
+
57
+ # Global Single Page App fallback routing
58
+ location / {
59
+ index index.html;
60
+ try_files $uri $uri/ /index.html;
61
+ }
62
+
63
+ # Force immediate cache validation over mutable structural assets
64
+ location = /index.html {
65
+ expires -1;
66
+ add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0" always;
67
+ }
68
+
69
+ location = /registry.json {
70
+ expires -1;
71
+ add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0" always;
72
+ }
73
+
74
+ # Safe Long-Term Caching: Target explicitly hashed Vite compilation output bundles
75
+ location ~* \.(css|js|mjs)$ {
76
+ expires 1y;
77
+ add_header Cache-Control "public, no-transform, immutable" always;
78
+ }
79
+
80
+ # Defensive Short-Term Cache: Un-hashed UI assets/icons revalidate daily
81
+ location ~* \.(png|jpg|jpeg|gif|svg|webp|ico|woff|woff2|ttf|eot)$ {
82
+ expires 1d;
83
+ add_header Cache-Control "public, must-revalidate" always;
84
+ }
85
+ }
86
+ }