Create nginx.conf
Browse files- nginx.conf +29 -0
nginx.conf
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
worker_processes auto;
|
2 |
+
|
3 |
+
events {
|
4 |
+
worker_connections 1024;
|
5 |
+
}
|
6 |
+
|
7 |
+
http {
|
8 |
+
server {
|
9 |
+
listen 7860;
|
10 |
+
server_name localhost;
|
11 |
+
|
12 |
+
# 处理 /hf 路径,将其转发到 chat-api 服务
|
13 |
+
location /hf/ {
|
14 |
+
rewrite ^/hf/(.*)$ /$1 break;
|
15 |
+
proxy_pass http://127.0.0.1:3000; # chat-api 的服务监听在 3000 端口
|
16 |
+
proxy_set_header Host $host;
|
17 |
+
proxy_set_header X-Real-IP $remote_addr;
|
18 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
19 |
+
}
|
20 |
+
|
21 |
+
# 默认情况下转发所有请求到 chat-api 服务
|
22 |
+
location / {
|
23 |
+
proxy_pass http://127.0.0.1:3000; # chat-api 的服务监听在 3000 端口
|
24 |
+
proxy_set_header Host $host;
|
25 |
+
proxy_set_header X-Real-IP $remote_addr;
|
26 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|