-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
76 lines (68 loc) · 2.71 KB
/
Copy pathnginx.conf
File metadata and controls
76 lines (68 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
server {
listen 10100;
server_name localhost;
client_max_body_size 20m;
# Add timeout settings to prevent 504 Gateway Timeout for long-running AI tasks
proxy_connect_timeout 300s;
send_timeout 300s;
root /usr/share/nginx/html;
index index.html;
# Enable gzip compression
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
gzip_vary on;
# Handle React Router - serve index.html for all routes
location / {
try_files $uri $uri/ /index.html;
}
# Proxy API calls to backend on same host (both using host network)
location /api/ {
proxy_pass http://127.0.0.1:10101/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 300s;
# Required for SSE: disable response buffering so events arrive
# incrementally instead of being flushed only at connection close.
proxy_buffering off;
proxy_cache off;
}
location /lightrag/ {
proxy_pass http://192.168.1.35:9621/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 300s;
}
# Proxy uploads to backend (for static file serving)
location /uploads/ {
proxy_pass http://127.0.0.1:10101/uploads/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Enable caching for uploaded images
expires 1y;
add_header Cache-Control "public, immutable";
}
# bundle.js has no content hash — must not use immutable caching
location = /bundle.js {
try_files $uri =404;
add_header Cache-Control "no-cache, must-revalidate";
}
# Cache static assets (but not uploads - those are proxied)
# Content-hashed assets (images, fonts, etc.) are safe to cache immutably
location ~* ^/(?!uploads/).*\.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}