nginx忘记加\了
Change-Id: I56175dd049b80688975bed17b488e1cb97021a1c
diff --git a/nginx.conf b/nginx.conf
index f41b74a..5319793 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -1,50 +1,64 @@
server {
listen 80;
- server_name _;
+ server_name team4.10813352.xyz;
- # 开启Gzip压缩(可选但推荐)
+ # 开启Gzip压缩
gzip on;
- gzip_types text/plain application/javascript application/x-javascript text/css;
+ gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
+ gzip_min_length 1000;
+ gzip_proxied any;
+ gzip_comp_level 6;
# 静态资源缓存优化
- location ~* \.(js|css|jpg|jpeg|png|gif|ico|svg|woff2)$ {
+ location ~* \.(js|css|jpg|jpeg|png|gif|ico|svg|woff2|ttf|eot)$ {
root /usr/share/nginx/html;
expires 1y;
- add_header Cache-Control "public, no-transform";
+ add_header Cache-Control "public, max-age=31536000, immutable";
try_files $uri =404;
+ access_log off;
}
- # 前端SPA路由处理
- location / {
- root /usr/share/nginx/html;
- index index.html;
- try_files $uri $uri/ /index.html;
- }
-
- # API代理
+ # API代理 - 指向后端服务
location /api/ {
- # Docker容器服务名解析
- resolver 127.0.0.11 valid=30s; # Docker内置DNS
-
- proxy_pass http://thunderhub-backend:5004$request_uri;
+ proxy_pass http://127.0.0.1:5004/; # 使用宿主机端口代理
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_connect_timeout 30s;
- proxy_read_timeout 90s;
+ proxy_read_timeout 300s;
+ proxy_send_timeout 300s;
- # WebSocket支持(如果后端需要)
+ # WebSocket支持
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
+ # 前端SPA路由处理 - 指向前端服务
+ location / {
+ proxy_pass http://127.0.0.1:3004; # 前端服务端口
+ 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;
+
+ # SPA路由重写
+ proxy_intercept_errors on;
+ error_page 404 = /index.html;
+ }
+
# 禁止访问隐藏文件
location ~ /\. {
deny all;
return 404;
}
+
+ # 错误页面处理
+ error_page 500 502 503 504 /50x.html;
+ location = /50x.html {
+ root /usr/share/nginx/html;
+ }
}
\ No newline at end of file
diff --git a/src/pages/Torrent/torrentDetail.tsx b/src/pages/Torrent/torrentDetail.tsx
index a5262fc..7e194a9 100644
--- a/src/pages/Torrent/torrentDetail.tsx
+++ b/src/pages/Torrent/torrentDetail.tsx
@@ -73,6 +73,7 @@
};
const getCategoryName = (catId: number) => {
+ console.log('categories', catId, categories);
return categories.find((c) => c.id === catId)?.name || '未知分类';
};
@@ -276,7 +277,7 @@
{torrent?.title}
</h1>
<div style={{ marginBottom: 8 }}>
- <Tag color="geekblue">{getCategoryName(torrent?.categoryId)}</Tag>
+ <Tag color="geekblue">{getCategoryName(torrent?.category)}</Tag>
{torrent?.tags?.map((tag: string) => (
<Tag key={tag} color="blue">{tag}</Tag>
))}
@@ -382,13 +383,6 @@
// </div>
// ) : (
// <>
-
-
-
-
-
-
-
// <Card
// style={{
// marginTop: 32,