docker化项目
> 还删除无关的public/vite.svg文件
Change-Id: If26b139f8a984aec1518c0233b52d2a6a25a5bb7
diff --git a/nginx.conf b/nginx.conf
new file mode 100644
index 0000000..51c2b08
--- /dev/null
+++ b/nginx.conf
@@ -0,0 +1,52 @@
+server {
+ listen 80;
+ server_name team1.10813352.xyz;
+
+ # 前端静态文件配置
+ root /usr/share/nginx/html;
+ index index.html;
+
+ # 解决 React Router 单页应用路由问题
+ location / {
+ try_files $uri $uri/ /index.html;
+
+ # 缓存策略
+ expires 7d; # 静态资源缓存7天
+ add_header Cache-Control "public";
+
+ # Gzip 压缩
+ gzip on;
+ gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
+ gzip_min_length 1024;
+ gzip_comp_level 6;
+ }
+
+ # API 请求代理到后端
+ location /api/ {
+ proxy_pass http://group1-backend:8080/; # 后端服务地址
+ 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_http_version 1.1;
+ proxy_set_header Connection "";
+
+ # 超时设置
+ proxy_connect_timeout 60s;
+ proxy_send_timeout 60s;
+ proxy_read_timeout 60s;
+ }
+
+ # 错误页面配置
+ error_page 404 /index.html;
+ error_page 500 502 503 504 /50x.html;
+
+ # 安全头设置
+ add_header X-Frame-Options "SAMEORIGIN" always;
+ add_header X-XSS-Protection "1; mode=block" always;
+ add_header X-Content-Type-Options "nosniff" always;
+ add_header Referrer-Policy "no-referrer-when-downgrade" always;
+ add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:" always;
+}
\ No newline at end of file