- 从服务器拉取完整代码 - 按框架规范整理项目结构 - 配置 Drone CI 测试环境部署 - 包含后端(FastAPI)、前端(Vue3)、管理端 技术栈: Vue3 + TypeScript + FastAPI + MySQL
33 lines
752 B
Plaintext
33 lines
752 B
Plaintext
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# 启用 gzip 压缩
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_min_length 1024;
|
|
gzip_types text/plain text/css text/javascript application/javascript application/json;
|
|
|
|
# 静态资源缓存
|
|
location /assets {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
# API 请求反向代理到对应后端
|
|
# 由 nginx 入口根据域名路由
|
|
location /api {
|
|
# 这里的 proxy_pass 会被外层 nginx 覆盖
|
|
# 仅当直接访问前端容器时使用
|
|
return 502;
|
|
}
|
|
|
|
# SPA 路由支持
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|