From 8928c348dfb313448379256d21f34e22d8d58f82 Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 21 Jul 2026 22:17:22 +0800 Subject: [PATCH] feat: add standalone Dockerfile with frontend and backend --- nginx-standalone.conf | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 nginx-standalone.conf diff --git a/nginx-standalone.conf b/nginx-standalone.conf new file mode 100644 index 0000000..bc0ddd7 --- /dev/null +++ b/nginx-standalone.conf @@ -0,0 +1,32 @@ +server { + listen 3000; + server_name localhost; + root /usr/share/nginx/html; + index index.html; + + # Gzip + gzip on; + gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript; + gzip_min_length 1000; + + # SPA fallback + location / { + try_files $uri $uri/ /index.html; + } + + # API proxy - 指向同一容器内的后端 + location /api/ { + proxy_pass http://127.0.0.1:8052; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } + + # Cache static assets + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ { + expires 1y; + add_header Cache-Control "public, immutable"; + } +}