Files
cyi-box/docker/nginx.conf
T
chiyiandDevin e2ba38a0c7 docker: nginx listens on 80 and 8890, backend moves to internal 8891
Deploy platforms that route to the container's exposed/compose port
(8890) were hitting the fun backend directly, which 404s unmatched
GET paths. Now nginx answers on both ports so either routing lands
on the SPA/API proxy layer.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-08 16:57:46 +08:00

83 lines
2.7 KiB
Nginx Configuration File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
server {
listen 80;
listen 8890;
server_name _;
root /app/web/dist;
index index.html;
client_max_body_size 512m;
# 前端 RPC 约定走 /api 前缀,反代时剥掉(与 vite dev proxy 行为一致)
# /cell 同时承载 fun.Stream 的 NDJSON 长连接,必须关缓冲
location /api/ {
proxy_pass http://127.0.0.1:8891/;
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 Connection "";
proxy_buffering off;
proxy_read_timeout 3600s;
}
# 对外协议端点(不带 /api 前缀,给第三方直接调):
# /mcp Streamable HTTP MCP(SSE 推送,关缓冲)
# /m/* 记忆阅读签名链接
# /v1/* 授权校验 / 代理提取
# /d/* 网盘分享下载
# /files/* SFTP 上传下载
# /ws/* SSH 终端 WebSocket
# /disk/* 网盘上传下载
# /dbm/* 数据库导入导出
# *.php Epay 兼容支付端点
location ~ ^/(cell|mcp|healthz|m)$ {
proxy_pass http://127.0.0.1:8891;
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_buffering off;
proxy_read_timeout 3600s;
}
location ~ ^/(m|d|v1|files|disk|dbm)/ {
proxy_pass http://127.0.0.1:8891;
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_buffering off;
}
location ~ ^/ws/ {
proxy_pass http://127.0.0.1:8891;
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 Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_buffering off;
proxy_read_timeout 3600s;
}
location ~ ^/(submit|mapi|api)\.php$ {
proxy_pass http://127.0.0.1:8891;
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;
}
# SPA 前端路由兜底
location / {
try_files $uri $uri/ /index.html;
}
location ~* \.(js|css|woff2?|ttf|png|jpe?g|svg|ico|webp)$ {
try_files $uri =404;
expires 7d;
}
}