feat: 娣诲姞 CI/CD 鑷姩鍖栭儴缃?(Dockerfile + Gitea Actions workflow)
CI/CD Deploy (Web) / 构建前端镜像并部署 (push) Failing after 2s
CI/CD Deploy (Web) / 构建前端镜像并部署 (push) Failing after 2s
This commit is contained in:
+58
@@ -0,0 +1,58 @@
|
||||
# =============================================================
|
||||
# freedom 统一入口 Nginx 配置
|
||||
# 同一域名路径区分:/api/* 反代到后端容器,其余走前端静态文件
|
||||
#
|
||||
# 后端接口无 /api 前缀,因此需要去掉前缀再转发。
|
||||
# 后端容器服务名:backend,端口:8800(见 docker-compose.yml)
|
||||
# =============================================================
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# 请求体大小限制(如有文件上传需求可调大)
|
||||
client_max_body_size 20m;
|
||||
|
||||
# ---------------- API 反向代理 ----------------
|
||||
# /api/xxx -> backend:8800/xxx (去掉 /api 前缀)
|
||||
location /api/ {
|
||||
proxy_pass http://backend:8800/;
|
||||
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_set_header Authorization $http_authorization;
|
||||
proxy_connect_timeout 10s;
|
||||
proxy_read_timeout 60s;
|
||||
}
|
||||
|
||||
# ---------------- Excel 模板静态文件 ----------------
|
||||
# 前端 nginxPath 指向 /excelTemplate.xxx,放在 Nginx 根目录静态文件
|
||||
location = /excelTemplate {
|
||||
alias /usr/share/nginx/html/;
|
||||
}
|
||||
location ~ ^/excelTemplate\.[a-zA-Z0-9]+$ {
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# ---------------- 前端静态资源 + SPA 路由 ----------------
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# 静态资源缓存
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|svg|ico|woff2?|ttf|eot)$ {
|
||||
expires 7d;
|
||||
add_header Cache-Control "public, max-age=604800";
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# 常见接口错误页面
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user