facc04aa65
本提交为 .git 对象库损坏后的重建提交,内容等价于原先三个本地提交 (5e2fd4c2 / 57a53c98 / 5d7e1873)的累积结果,未做任何额外改动。 一、docs 结构整改(整改 #14) 根因:重构时新结构为 untracked 文件,执行 git stash(未带 -u)未纳入, 随后 git reset 拉回 HEAD 旧 tracked 树,导致旧树复活、新旧两棵目录 树并存于 docs/,共 791 文件、双分类体系冲突。 修复动作: - b2 同名异主题文件改名迁移保全 9 个 - C 类 39 个孤立文件按主题正确归类 - A/B1 类 222 个重复文件删除(新结构已有内容副本) - 9 个旧独有空目录删除 - 270 处内部引用按 verified 映射改写 - 整改记录 #14 登记于 04-运维文档/部署运维 结果:docs 791 → 569 文件,顶层仅规范 8 类 + 治理文件,单树恢复。 残留:约 20 处指向从未存在文件的陈旧死链,归入独立文档卫生任务。 二、compose 双目录对齐(消除踩坑 A) - docker-compose.yml:nginx 前端挂载全部由根目录 frontend-*/dist 改为 src/frontend-*/dist(h5 / agent / admin / terminal) - docker-compose.dev.yml:dev 服务 build context 与卷同步改 src/ - 效果:本地 docker compose up 不再把根目录 stale dist 挂回, 与线上一致,分叉隐患消除(已 docker compose config 校验通过) 防复发铁律: - 重构须提交;仓库修复须 git stash -u 或先 commit - 新结构须 git add 并提交,避免再次 untracked 复活 - H5 改动只动 src/frontend-h5/,禁改根目录遗留 frontend-*/
139 lines
5.9 KiB
Plaintext
139 lines
5.9 KiB
Plaintext
# =============================================================================
|
||
# 企微IT智能服务台 — Nginx 配置(NAS + Cloudflare Tunnel 版)
|
||
# =============================================================================
|
||
# 与标准 nginx.conf 的区别:
|
||
# 1. 移除 / 根路径反代到 IT 数据查询平台(NAS 上没有此服务)
|
||
# 2. 增加 Cloudflare 真实 IP 还原(CF-Connecting-IP)
|
||
# 3. 增加 HSTS 和安全头(通过 Tunnel 时客户端是 HTTPS)
|
||
# 4. 增加 /api/wecom/callback 路径用于企微消息回调
|
||
# =============================================================================
|
||
|
||
events {
|
||
worker_connections 1024;
|
||
}
|
||
|
||
http {
|
||
include /etc/nginx/mime.types;
|
||
default_type application/octet-stream;
|
||
|
||
# ------------------------------------------------------------------
|
||
# 日志格式(增加 CF 真实 IP)
|
||
# ------------------------------------------------------------------
|
||
log_format main '$http_x_forwarded_for - $remote_user [$time_local] "$request" '
|
||
'$status $body_bytes_sent "$http_referer" '
|
||
'"$http_user_agent"';
|
||
|
||
access_log /var/log/nginx/access.log main;
|
||
error_log /var/log/nginx/error.log warn;
|
||
|
||
# ------------------------------------------------------------------
|
||
# 基础配置
|
||
# ------------------------------------------------------------------
|
||
sendfile on;
|
||
tcp_nopush on;
|
||
tcp_nodelay on;
|
||
keepalive_timeout 65;
|
||
types_hash_max_size 2048;
|
||
client_max_body_size 50m; # 支持文件上传(企微媒体文件)
|
||
|
||
# ------------------------------------------------------------------
|
||
# Gzip 压缩(前端静态资源)
|
||
# ------------------------------------------------------------------
|
||
gzip on;
|
||
gzip_vary on;
|
||
gzip_min_length 1024;
|
||
gzip_types text/plain text/css text/xml text/javascript
|
||
application/javascript application/xml+rss
|
||
application/json application/ld+json;
|
||
|
||
# =================================================================
|
||
# 上游服务定义(Docker 内部网络)
|
||
# =================================================================
|
||
upstream backend_api {
|
||
server backend:8000;
|
||
}
|
||
|
||
# =================================================================
|
||
# 主服务:监听 80 端口(Cloudflare Tunnel 终止 SSL,容器内走 HTTP)
|
||
# =================================================================
|
||
server {
|
||
listen 80;
|
||
server_name itdesk.amanzac.com;
|
||
|
||
# ------------------------------------------------------------------
|
||
# 安全头(通过 Cloudflare Tunnel 时客户端是 HTTPS)
|
||
# ------------------------------------------------------------------
|
||
# 告诉浏览器只通过 HTTPS 访问(通过 Cloudflare 的 HSTS 配置更佳)
|
||
add_header X-Content-Type-Options "nosniff" always;
|
||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||
add_header X-XSS-Protection "1; mode=block" always;
|
||
|
||
# ------------------------------------------------------------------
|
||
# 健康检查端点(用于 Docker healthcheck)
|
||
# ------------------------------------------------------------------
|
||
location = /itdesk/health {
|
||
access_log off;
|
||
return 200 "healthy\n";
|
||
add_header Content-Type text/plain;
|
||
}
|
||
|
||
# ------------------------------------------------------------------
|
||
# H5 员工端 — /itdesk/
|
||
# ------------------------------------------------------------------
|
||
location /itdesk/ {
|
||
alias /usr/share/nginx/html/itdesk/;
|
||
index index.html;
|
||
try_files $uri /itdesk/index.html;
|
||
}
|
||
|
||
# ------------------------------------------------------------------
|
||
# 坐席工作台 — /itagent/
|
||
# ------------------------------------------------------------------
|
||
location /itagent/ {
|
||
alias /usr/share/nginx/html/itagent/;
|
||
index index.html;
|
||
try_files $uri /itagent/index.html;
|
||
}
|
||
|
||
# ------------------------------------------------------------------
|
||
# 后端 API — /api/
|
||
# ------------------------------------------------------------------
|
||
location /api/ {
|
||
proxy_pass http://backend_api/;
|
||
proxy_set_header Host $host;
|
||
# Cloudflare 真实 IP 还原
|
||
proxy_set_header X-Real-IP $http_cf_connecting_ip;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
# Cloudflare Tunnel 终止 SSL,告知后端原始协议是 HTTPS
|
||
proxy_set_header X-Forwarded-Proto https;
|
||
|
||
# 超时设置(AI 回复可能较慢)
|
||
proxy_connect_timeout 60s;
|
||
proxy_send_timeout 300s;
|
||
proxy_read_timeout 300s;
|
||
}
|
||
|
||
# ------------------------------------------------------------------
|
||
# WebSocket — /ws/(坐席端实时通信)
|
||
# ------------------------------------------------------------------
|
||
location /ws/ {
|
||
proxy_pass http://backend_api;
|
||
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 $http_cf_connecting_ip;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
proxy_set_header X-Forwarded-Proto https;
|
||
proxy_read_timeout 86400s; # WebSocket 长连接
|
||
}
|
||
|
||
# ------------------------------------------------------------------
|
||
# 默认路径 — 重定向到 H5 员工端
|
||
# ------------------------------------------------------------------
|
||
location = / {
|
||
return 302 /itdesk/;
|
||
}
|
||
}
|
||
}
|