修改nginx对应的容器名

This commit is contained in:
小贺
2025-09-02 23:15:05 +08:00
parent db673b4698
commit 37d1dd22bc
2 changed files with 3 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ services:
build:
context: ./front
dockerfile: dockerfile
container_name: my-frontend-web
ports:
- "5555:5555" # 修改为5555端口映射
depends_on:
@@ -16,6 +17,7 @@ services:
build:
context: ./backend
dockerfile: dockerfile
container_name: my-backend-api # 设置后端容器名
networks:
- app-network

View File

@@ -21,7 +21,7 @@ http {
# 代理API请求到后端
location /api/ {
proxy_pass http://backend:5000/;
proxy_pass http://my-backend-api: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;