File size: 889 Bytes
d4c4129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
worker_processes auto;

events {
    worker_connections 1024;
}

http {
    server {
        listen 7860;
        server_name localhost;

        # 处理 /hf 路径,将其转发到 chat-api 服务
        location /hf/ {
            rewrite ^/hf/(.*)$ /$1 break;
            proxy_pass http://127.0.0.1:3000; # chat-api 的服务监听在 3000 端口
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

        # 默认情况下转发所有请求到 chat-api 服务
        location / {
            proxy_pass http://127.0.0.1:3000; # chat-api 的服务监听在 3000 端口
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
    }
}