charles_c il y a 5 mois
Parent
commit
2704c0ceeb
2 fichiers modifiés avec 4 ajouts et 6 suppressions
  1. 0 6
      nginx/default.conf
  2. 4 0
      src/app/api/upload/route.js

+ 0 - 6
nginx/default.conf

@@ -20,12 +20,6 @@ server {
         proxy_read_timeout 60s;
     }
 
-    location /uploads {
-        alias /app/public/uploads;
-        try_files $uri $uri/ =404;
-        add_header X-Debug-Message "$document_root$uri" always;
-    }
-
     # 添加健康检查路由
     location /health {
         access_log off;

+ 4 - 0
src/app/api/upload/route.js

@@ -1,4 +1,5 @@
 import { writeFile } from "fs/promises";
+import { chmod } from "fs/promises";
 import { NextResponse } from "next/server";
 import path from "path";
 import { setCORSHeaders } from "../../lib/apiUtils";
@@ -25,6 +26,9 @@ export async function POST(request) {
 
     await writeFile(filepath, buffer);
 
+    // 设置文件权限为 0755 (rwxr-xr-x)
+    await chmod(filepath, 0o755);
+
     const response = NextResponse.json({
       success: true,
       filename,