-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathnginx.conf
More file actions
41 lines (39 loc) · 1.27 KB
/
nginx.conf
File metadata and controls
41 lines (39 loc) · 1.27 KB
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
31
32
33
34
35
36
37
38
39
40
41
# 前端路由
server {
listen 8080; # 前端端口
server_name localhost;
client_max_body_size 50M;
location / {
proxy_pass http://frontend-container:8080/; # 将请求转发到前端容器
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;
}
}
# 管理端路由
server {
listen 8081; # 管理端端口
server_name localhost;
client_max_body_size 50M;
location / {
proxy_pass http://admin-container:8081/; # 将请求转发到管理端容器
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;
}
}
# 后端 API 路由
server {
listen 5000; # 后端端口
server_name localhost;
client_max_body_size 50M;
location /api/ {
proxy_pass http://backend-container:5000/; # 确保以 / 结尾
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;
}
}