Files
TaskPool/nginx-standalone.conf
admin 2c9b44aeca
Build and Deploy / build-and-push (push) Successful in 53s
fix(nginx): add proxy config for /mcp and /open2api endpoints
2026-07-27 03:04:20 +08:00

54 lines
1.5 KiB
Plaintext

server {
listen 3000;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Gzip
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript;
gzip_min_length 1000;
# API proxy - 指向同一容器内的后端
location /api/ {
proxy_pass http://127.0.0.1:8052;
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;
}
# MCP Server proxy - AI Agent 接入
location /mcp {
proxy_pass http://127.0.0.1:8052;
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_buffering off;
proxy_cache off;
}
# OpenAPI proxy
location /open2api/ {
proxy_pass http://127.0.0.1:8052;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
# SPA fallback
location / {
try_files $uri $uri/ /index.html;
}
# Cache static assets
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}