优化MCP消息转发Nginx配置文件

This commit is contained in:
wangbo 2025-05-15 12:09:53 +08:00
parent eaba13df5b
commit ccfac882d7
2 changed files with 20 additions and 0 deletions

View File

@ -95,6 +95,20 @@ server {
proxy_set_header Connection $connection_upgrade; proxy_set_header Connection $connection_upgrade;
proxy_buffering off; # 对于 WebSocket 连接禁用缓冲 proxy_buffering off; # 对于 WebSocket 连接禁用缓冲
} }
# 转发/mcp/messages 消息到3001
location /mcp {
proxy_pass http://127.0.0.1:3001/mcp;
proxy_read_timeout 300s;
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_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_buffering off; # 对于 WebSocket 连接禁用缓冲
}
} }
# chatapi 大语言模型转发子域名配置 # chatapi 大语言模型转发子域名配置
server { server {

View File

@ -40,6 +40,12 @@ else
if [ -f /etc/debian_version ]; then if [ -f /etc/debian_version ]; then
# Ubuntu/Debian 系统 # Ubuntu/Debian 系统
apt install -y certbot python3-certbot-nginx apt install -y certbot python3-certbot-nginx
# 也可以使用snapd安装
# apt install -y snapd
# # 使用snap安装 certbot
# snap install --classic certbot
# # Prepare the Certbot command
# sudo ln -s /snap/bin/certbot /usr/bin/certbot
elif [ -f /etc/redhat-release ]; then elif [ -f /etc/redhat-release ]; then
# CentOS/RHEL 系统 # CentOS/RHEL 系统
# 首先安装 EPEL 仓库 # 首先安装 EPEL 仓库