forked from RoseKhlifa/Terminal-Farm-Business
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfarm_v5.conf
More file actions
48 lines (42 loc) · 1.36 KB
/
farm_v5.conf
File metadata and controls
48 lines (42 loc) · 1.36 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
server {
listen 8888;
server_name _;
# 1. 静态前端 (对应您部署脚本中的位置)
root /var/www/farm;
index index.html;
# 针对 index.html 强制不缓存 (关键修改)
location = /index.html {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
add_header Expires 0;
try_files $uri $uri/ /index.html;
}
# 其他静态资源正常访问
location / {
try_files $uri $uri/ /index.html;
}
# 2. Admin API (转发给 2222)
location /api/admin/ {
proxy_pass http://127.0.0.1:2222;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
# 3. 普通 API (转发给 11454,关键在于去掉 /api 前缀)
location /api/ {
proxy_pass http://127.0.0.1:11454/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
# 4. Admin 页面资源 (转发给 2222)
location /admin {
proxy_pass http://127.0.0.1:2222;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}