From 4fc879212eb37dc5d11fc486682b62202bd059cf Mon Sep 17 00:00:00 2001 From: mfnefd Date: Sun, 3 Nov 2024 20:15:43 +0400 Subject: [PATCH] =?UTF-8?q?=D1=8D=D1=8D=D1=8D...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- balakhonov_danila_lab_3/ApiWaiter/Dockerfile | 2 -- balakhonov_danila_lab_3/docker-compose.yaml | 7 +++++-- balakhonov_danila_lab_3/nginx.conf | 21 ++++++++++++++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 balakhonov_danila_lab_3/nginx.conf diff --git a/balakhonov_danila_lab_3/ApiWaiter/Dockerfile b/balakhonov_danila_lab_3/ApiWaiter/Dockerfile index 6a34796..dcfed5e 100644 --- a/balakhonov_danila_lab_3/ApiWaiter/Dockerfile +++ b/balakhonov_danila_lab_3/ApiWaiter/Dockerfile @@ -6,6 +6,4 @@ RUN npm i COPY . . -EXPOSE 4000 - ENTRYPOINT ["npm", "run", "start"] \ No newline at end of file diff --git a/balakhonov_danila_lab_3/docker-compose.yaml b/balakhonov_danila_lab_3/docker-compose.yaml index f640e48..94f2127 100644 --- a/balakhonov_danila_lab_3/docker-compose.yaml +++ b/balakhonov_danila_lab_3/docker-compose.yaml @@ -3,6 +3,8 @@ services: build: ./ApiRestaurant/ environment: WAITER_API_URL: http://waiter-service:4000 + expose: + - 6666 depends_on: - waiter-service @@ -10,8 +12,9 @@ services: build: ./ApiWaiter/ environment: PORT: 4000 - ports: - - "4000:4000" + expose: + - 4000 + nginx: image: nginx diff --git a/balakhonov_danila_lab_3/nginx.conf b/balakhonov_danila_lab_3/nginx.conf new file mode 100644 index 0000000..bdb46d0 --- /dev/null +++ b/balakhonov_danila_lab_3/nginx.conf @@ -0,0 +1,21 @@ +server { + listen 80; + listen [::]:80; + server_name restawaiters; + + location /waiters/ { + proxy_pass http://waiter-service:4000/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Prefix /test; + } + + location /restaurants/ { + proxy_pass http://restaurant-service:6666/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Prefix /admin; + } +}