修改nginx对应的容器名
This commit is contained in:
@@ -5,6 +5,7 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: ./front
|
context: ./front
|
||||||
dockerfile: dockerfile
|
dockerfile: dockerfile
|
||||||
|
container_name: my-frontend-web
|
||||||
ports:
|
ports:
|
||||||
- "5555:5555" # 修改为5555端口映射
|
- "5555:5555" # 修改为5555端口映射
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -16,6 +17,7 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: ./backend
|
context: ./backend
|
||||||
dockerfile: dockerfile
|
dockerfile: dockerfile
|
||||||
|
container_name: my-backend-api # 设置后端容器名
|
||||||
networks:
|
networks:
|
||||||
- app-network
|
- app-network
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ http {
|
|||||||
|
|
||||||
# 代理API请求到后端
|
# 代理API请求到后端
|
||||||
location /api/ {
|
location /api/ {
|
||||||
proxy_pass http://backend:5000/;
|
proxy_pass http://my-backend-api:5000/;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
|||||||
Reference in New Issue
Block a user