Files
000-platform/deploy/nginx/frontend.conf
Admin b6b5ac61af
All checks were successful
continuous-integration/drone/push Build is passing
fix: 修复 Drone 配置和 nginx 多环境支持
- 分离测试/生产环境的前端镜像构建
- nginx 配置使用 BACKEND_HOST 变量区分环境
- 生产环境添加独立的 Docker network
- 生产环境使用独立的密钥配置 (xxx_prod)
- 修复前端空白问题:确保前后端在同一 network
2026-01-24 17:15:12 +08:00

41 lines
1.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Docker 内部 DNS 解析器
resolver 127.0.0.11 valid=30s;
# Vue Router history mode
location / {
try_files $uri $uri/ /index.html;
}
# API 代理到后端
# 使用环境变量 BACKEND_HOST通过 Docker DNS 解析
location /api/ {
set $backend ${BACKEND_HOST}:8000;
proxy_pass http://$backend/api/;
proxy_http_version 1.1;
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_read_timeout 120s;
proxy_connect_timeout 10s;
}
# 静态资源缓存
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# 禁止访问隐藏文件
location ~ /\. {
deny all;
}
}