From f677ee261e7a0316d3dce2de5c446ad5d2bee781 Mon Sep 17 00:00:00 2001 From: Luyus <2593026969@qq.com> Date: Sun, 11 Jan 2026 15:19:12 +0800 Subject: [PATCH] Luyus --- docker-compose.yml | 4 ++++ nginx.conf | 59 ++++++++++++++-------------------------------- 2 files changed, 22 insertions(+), 41 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index c972e1a..b550dc6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,3 +1,7 @@ +# 此文件已废弃 +# 前端容器已整合到 coin-exchange-new/docker-compose.yml 中 +# 请使用后端的 docker-compose.yml 进行部署 + version: '3.8' services: diff --git a/nginx.conf b/nginx.conf index 0d9a612..d4da67c 100644 --- a/nginx.conf +++ b/nginx.conf @@ -5,47 +5,6 @@ server { root /usr/share/nginx/html; index index.html index.htm; - # API 反向代理到后端网关 - location /admin/ { - proxy_pass http://coin-gateway-server:8080/admin/; - 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; - } - - location /user/ { - proxy_pass http://coin-gateway-server:8080/user/; - 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; - } - - location /finance/ { - proxy_pass http://coin-gateway-server:8080/finance/; - 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; - } - - location /exchange/ { - proxy_pass http://coin-gateway-server:8080/exchange/; - 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; - } - - location /v2/ { - proxy_pass http://coin-gateway-server:8080/v2/; - 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; - } - # 处理 Vue Router 的历史模式 location / { try_files $uri $uri/ /index.html; @@ -68,3 +27,21 @@ server { gzip_types text/plain text/css application/json application/javascript text/xml application/xml; gzip_min_length 1024; } + + # 静态资源缓存 + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { + expires 30d; + add_header Cache-Control "public, immutable"; + } + + # 禁用缓存 index.html + location = /index.html { + expires -1; + add_header Cache-Control "no-cache, no-store, must-revalidate"; + } + + # Gzip 压缩 + gzip on; + gzip_types text/plain text/css application/json application/javascript text/xml application/xml; + gzip_min_length 1024; +}