Spaces:
Running
Running
github-actions[bot] commited on
Commit ·
ae8934c
1
Parent(s): f037e20
deploy: 05c4a54 — 更新 nginx.conf
Browse files- frontend/nginx.conf +18 -84
frontend/nginx.conf
CHANGED
|
@@ -1,96 +1,30 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
events {
|
| 6 |
-
worker_connections 4096;
|
| 7 |
-
multi_accept on;
|
| 8 |
-
}
|
| 9 |
-
|
| 10 |
-
http {
|
| 11 |
-
include /etc/nginx/mime.types;
|
| 12 |
-
default_type application/octet-stream;
|
| 13 |
|
| 14 |
```
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
'"$http_user_agent" rt=$request_time';
|
| 18 |
-
|
| 19 |
-
access_log /var/log/nginx/access.log main;
|
| 20 |
-
|
| 21 |
-
sendfile on;
|
| 22 |
-
tcp_nopush on;
|
| 23 |
-
tcp_nodelay on;
|
| 24 |
-
keepalive_timeout 65;
|
| 25 |
-
gzip on;
|
| 26 |
-
gzip_vary on;
|
| 27 |
-
gzip_proxied any;
|
| 28 |
-
gzip_comp_level 6;
|
| 29 |
-
gzip_types text/plain text/css text/xml application/json application/javascript
|
| 30 |
-
application/xml+rss application/atom+xml image/svg+xml;
|
| 31 |
-
|
| 32 |
-
limit_req_zone $binary_remote_addr zone=api:10m rate=100r/m;
|
| 33 |
-
limit_req_zone $binary_remote_addr zone=v1:10m rate=200r/m;
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
}
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
|
|
|
| 43 |
}
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
|
|
|
| 48 |
}
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
server_name _;
|
| 53 |
-
|
| 54 |
-
client_max_body_size 100M;
|
| 55 |
-
proxy_read_timeout 300s;
|
| 56 |
-
proxy_connect_timeout 10s;
|
| 57 |
-
proxy_send_timeout 300s;
|
| 58 |
-
|
| 59 |
-
location /v1/ {
|
| 60 |
-
limit_req zone=v1 burst=50 nodelay;
|
| 61 |
-
proxy_pass http://litellm;
|
| 62 |
-
proxy_http_version 1.1;
|
| 63 |
-
proxy_set_header Host $host;
|
| 64 |
-
proxy_set_header X-Real-IP $remote_addr;
|
| 65 |
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 66 |
-
proxy_set_header X-Forwarded-Proto $scheme;
|
| 67 |
-
proxy_set_header Connection "";
|
| 68 |
-
proxy_buffering off;
|
| 69 |
-
proxy_cache off;
|
| 70 |
-
chunked_transfer_encoding on;
|
| 71 |
-
proxy_read_timeout 300s;
|
| 72 |
-
}
|
| 73 |
-
|
| 74 |
-
location /api/ {
|
| 75 |
-
limit_req zone=api burst=20 nodelay;
|
| 76 |
-
proxy_pass http://backend;
|
| 77 |
-
proxy_http_version 1.1;
|
| 78 |
-
proxy_set_header Host $host;
|
| 79 |
-
proxy_set_header X-Real-IP $remote_addr;
|
| 80 |
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 81 |
-
proxy_set_header X-Forwarded-Proto $scheme;
|
| 82 |
-
proxy_set_header Connection "";
|
| 83 |
-
}
|
| 84 |
-
|
| 85 |
-
location / {
|
| 86 |
-
proxy_pass http://frontend;
|
| 87 |
-
proxy_http_version 1.1;
|
| 88 |
-
proxy_set_header Host $host;
|
| 89 |
-
proxy_set_header X-Real-IP $remote_addr;
|
| 90 |
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 91 |
-
proxy_set_header Connection "";
|
| 92 |
-
}
|
| 93 |
-
}
|
| 94 |
```
|
| 95 |
|
| 96 |
}
|
|
|
|
| 1 |
+
server {
|
| 2 |
+
listen 80;
|
| 3 |
+
server_name _;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
```
|
| 6 |
+
root /usr/share/nginx/html;
|
| 7 |
+
index index.html;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
# SPA 路由支持
|
| 10 |
+
location / {
|
| 11 |
+
try_files $uri $uri/ /index.html;
|
| 12 |
}
|
| 13 |
|
| 14 |
+
# 静态资源长缓存
|
| 15 |
+
location /assets/ {
|
| 16 |
+
expires 1y;
|
| 17 |
+
add_header Cache-Control "public, immutable";
|
| 18 |
}
|
| 19 |
|
| 20 |
+
# HTML 不缓存
|
| 21 |
+
location = /index.html {
|
| 22 |
+
add_header Cache-Control "no-cache, must-revalidate";
|
| 23 |
+
expires 0;
|
| 24 |
}
|
| 25 |
|
| 26 |
+
gzip on;
|
| 27 |
+
gzip_types text/plain text/css application/json application/javascript text/xml application/xml image/svg+xml;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
```
|
| 29 |
|
| 30 |
}
|