51 lines
1.6 KiB
Plaintext
51 lines
1.6 KiB
Plaintext
# QLinker 前端容器入口(任务 020)
|
|||
|
|
# 后端不托管静态资源:vite build 产物由 Nginx 提供,/api 与 NapCat 入站路径反向代理到 app:8080。
|
||
|
|
server {
|
||
|
|
listen 80;
|
||
|
|
server_name _;
|
||
|
|
|
||
|
|
root /usr/share/nginx/html;
|
||
|
|
index index.html;
|
||
|
|
server_tokens off;
|
||
|
|
|
||
|
|
# NapCat HTTP 回调与消息体上限;后端自身仍会做请求体大小校验。
|
||
|
|
client_max_body_size 16m;
|
||
|
|
|
||
|
|
gzip on;
|
||
|
|
gzip_min_length 1024;
|
||
|
|
gzip_types text/css application/javascript application/json image/svg+xml;
|
||
|
|
|
||
|
|
location /api/ {
|
||
|
|
proxy_pass http://app:8080;
|
||
|
|
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;
|
||
|
|
}
|
||
|
|
|
||
|
|
location /actuator/health {
|
||
|
|
proxy_pass http://app:8080;
|
||
|
|
proxy_set_header Host $host;
|
||
|
|
access_log off;
|
||
|
|
}
|
||
|
|
|
||
|
|
# 反向 WebSocket / HTTP 回调入口(默认关闭,启用后由这里转发)。
|
||
|
|
location /napcat/ {
|
||
|
|
proxy_pass http://app:8080;
|
||
|
|
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 $remote_addr;
|
||
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
|
|
proxy_read_timeout 300s;
|
||
|
|
}
|
||
|
|
|
||
|
|
# 前端使用 hash 路由(createWebHashHistory),try_files 仅作为兜底。
|
||
|
|
location / {
|
||
|
|
try_files $uri $uri/ /index.html;
|
||
|
|
}
|
||
|
|
}
|