diff --git a/Dockerfile b/Dockerfile index d3e0651..1fa6a17 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,7 +29,7 @@ FROM nginx:1.26-alpine3.19 AS runner WORKDIR /app # envs 配置 -ENV APP_API_URL http://localhost:50000 +ENV APP_API_URL localhost:50000 # nginx配置文件 COPY nginx.conf /etc/nginx/conf.d/default.conf.template diff --git a/nginx.conf b/nginx.conf index 83676f0..30a1a63 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,3 +1,7 @@ +upstream payment_backend { + server $APP_API_URL; +} + server { listen 80; listen [::]:80; @@ -22,7 +26,7 @@ server { } location ^~/api { - proxy_pass $APP_API_URL; + proxy_pass http://payment_backend; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;