详细的配置说明和核心代码片段,帮助您快速落地集成方案。
Nginx 作为反向代理服务器,负责将不同路径的请求分发到对应的后端服务。 这是实现“双后端共存”的关键基础设施。
server {
listen 80;
server_name your-app.com;
# ShipAny Frontend & API
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
# Manus API
location /manus-api/ {
proxy_pass http://localhost:5000/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
# CORS headers if needed
add_header 'Access-Control-Allow-Origin' 'https://your-app.com';
add_header 'Access-Control-Allow-Credentials' 'true';
}
}