固定前端端口为 7380、后端端口为 7381,避开 3000/5173/8080 等常见开发端口,防止与同机其它工程互占。 - 更新根目录、backend、web 的 .env.example 与 README、Makefile 说明 - 同步 vite.config.ts、web/package.json、desktop/main.cjs 默认地址 - 同步 backend config.go 默认端口常量、Dockerfile 与 docker-compose 健康检查 - 同步 deploy/nginx.conf 监听与反代、Dockerfile.web 端口 - 后端新增 godotenv 加载 backend/.env,真实环境变量优先 - AGENTS.md 补充端口约定与按 PID 清理进程的强制规范 - 新增 preflight 脚本并在 pnpm dev 前执行
40 lines
1003 B
Nginx Configuration File
40 lines
1003 B
Nginx Configuration File
server {
|
|
listen 7380;
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
gzip on;
|
|
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
|
|
gzip_min_length 1024;
|
|
|
|
# 带哈希的构建产物可长期缓存
|
|
location /assets/ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
# SPA 路由回退
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# 后端 API
|
|
location /api/ {
|
|
proxy_pass http://api:7381;
|
|
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;
|
|
|
|
# SSE:关闭缓冲并延长超时
|
|
proxy_set_header Connection "";
|
|
proxy_buffering off;
|
|
proxy_cache off;
|
|
proxy_read_timeout 3600s;
|
|
chunked_transfer_encoding on;
|
|
}
|
|
}
|