From a2e796257c09e8de28084100be5c648da12dc585 Mon Sep 17 00:00:00 2001 From: vipg Date: Wed, 12 Nov 2025 17:33:40 +0800 Subject: [PATCH] add --- frontend/asset-assistant-system/Dockerfile | 17 --------- .../assets/js/config/menu.js | 2 +- .../{pages => }/index.html | 0 .../{pages => }/login.html | 0 frontend/asset-assistant-system/nginx.conf | 37 ------------------- .../pages/{modules => }/country.html | 0 6 files changed, 1 insertion(+), 55 deletions(-) delete mode 100644 frontend/asset-assistant-system/Dockerfile rename frontend/asset-assistant-system/{pages => }/index.html (100%) rename frontend/asset-assistant-system/{pages => }/login.html (100%) delete mode 100644 frontend/asset-assistant-system/nginx.conf rename frontend/asset-assistant-system/pages/{modules => }/country.html (100%) diff --git a/frontend/asset-assistant-system/Dockerfile b/frontend/asset-assistant-system/Dockerfile deleted file mode 100644 index 7f742fa..0000000 --- a/frontend/asset-assistant-system/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# 生产阶段:使用指定版本的 Nginx Alpine 镜像(大小写统一) -FROM nginx:1.29.3-alpine AS production-stage - -# 清除 Nginx 默认静态文件 -RUN rm -rf /usr/share/nginx/html/* - -# 复制项目所有文件到 Nginx 静态文件目录(适配你的项目结构) -COPY . /usr/share/nginx/html - -# 复制自定义 Nginx 配置(解决 SPA 路由刷新 404 问题,必须添加) -COPY ./nginx.conf /etc/nginx/conf.d/default.conf - -# 暴露 80 端口 -EXPOSE 80 - -# 启动 Nginx(前台运行) -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/frontend/asset-assistant-system/assets/js/config/menu.js b/frontend/asset-assistant-system/assets/js/config/menu.js index 6acb122..38f43b6 100644 --- a/frontend/asset-assistant-system/assets/js/config/menu.js +++ b/frontend/asset-assistant-system/assets/js/config/menu.js @@ -12,7 +12,7 @@ window.MenuConfig = [ id: 'country', icon: '🌎', title: '国家管理', - url: 'modules/country.html' + url: 'country.html' } ] } diff --git a/frontend/asset-assistant-system/pages/index.html b/frontend/asset-assistant-system/index.html similarity index 100% rename from frontend/asset-assistant-system/pages/index.html rename to frontend/asset-assistant-system/index.html diff --git a/frontend/asset-assistant-system/pages/login.html b/frontend/asset-assistant-system/login.html similarity index 100% rename from frontend/asset-assistant-system/pages/login.html rename to frontend/asset-assistant-system/login.html diff --git a/frontend/asset-assistant-system/nginx.conf b/frontend/asset-assistant-system/nginx.conf deleted file mode 100644 index 135bfd1..0000000 --- a/frontend/asset-assistant-system/nginx.conf +++ /dev/null @@ -1,37 +0,0 @@ -server { - listen 80; - server_name localhost; - root /usr/share/nginx/html; - index index.html; # 入口文件指向项目根目录的 index.html - - # 支持 SPA 路由重写(关键:解决刷新404) - location / { - try_files $uri $uri/ /index.html; - add_header Cache-Control "no-cache"; # 入口文件不缓存 - } - - # 静态资源缓存配置(JS/CSS/图片等) - location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|otf)$ { - expires 7d; # 缓存7天 - add_header Cache-Control "public, max-age=604800"; - add_header Access-Control-Allow-Origin "*"; # 允许跨域(可选) - } - - # 禁止访问隐藏文件(如 .git、.env 等) - location ~ /\. { - deny all; - access_log off; - log_not_found off; - } - - # 优化 Nginx 响应速度 - sendfile on; - tcp_nopush on; - tcp_nodelay on; - keepalive_timeout 65; - types_hash_max_size 2048; - - # 关闭不必要的日志 - access_log off; - error_log /var/log/nginx/error.log warn; -} \ No newline at end of file diff --git a/frontend/asset-assistant-system/pages/modules/country.html b/frontend/asset-assistant-system/pages/country.html similarity index 100% rename from frontend/asset-assistant-system/pages/modules/country.html rename to frontend/asset-assistant-system/pages/country.html