美化前端

Change-Id: I46437caf832dd8f18358354f024724f7e31524cb
diff --git a/nginx.conf b/nginx.conf
index 91da21a..f41b74a 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -1,21 +1,50 @@
 server {
-    listen 80; 
+    listen 80;
+    server_name _;
+    
+    # 开启Gzip压缩(可选但推荐)
+    gzip on;
+    gzip_types text/plain application/javascript application/x-javascript text/css;
+    
+    # 静态资源缓存优化
+    location ~* \.(js|css|jpg|jpeg|png|gif|ico|svg|woff2)$ {
+        root /usr/share/nginx/html;
+        expires 1y;
+        add_header Cache-Control "public, no-transform";
+        try_files $uri =404;
+    }
 
-    server_name _;  # 允许所有域名访问
-
-    # 静态资源处理
+    # 前端SPA路由处理
     location / {
         root /usr/share/nginx/html;
         index index.html;
         try_files $uri $uri/ /index.html;
     }
 
-    # 反向代理API请求到后端
+    # API代理
     location /api/ {
-        proxy_pass http://thunderhub-backend:5004;  # 代理路径与后端API前缀匹配
+        # Docker容器服务名解析
+        resolver 127.0.0.11 valid=30s; # Docker内置DNS
+        
+        proxy_pass http://thunderhub-backend:5004$request_uri;
         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;
+        
+        # WebSocket支持(如果后端需要)
+        proxy_http_version 1.1;
+        proxy_set_header Upgrade $http_upgrade;
+        proxy_set_header Connection "upgrade";
+    }
+    
+    # 禁止访问隐藏文件
+    location ~ /\. {
+        deny all;
+        return 404;
     }
 }
\ No newline at end of file