From e91deac91ff3a5a13c7289e1daa0d4c05bac481b Mon Sep 17 00:00:00 2001 From: Egor Matveev Date: Wed, 9 Mar 2022 00:57:15 +0300 Subject: [PATCH] nginx --- Dockerfile | 6 ++---- nginx.conf | 23 ++++++++++++----------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 51f7c89..8fcd8bf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ FROM docker:dind -RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python +RUN apk add --update python3 && ln -sf python3 /usr/bin/python RUN python3 -m ensurepip RUN apk update && apk add postgresql-dev gcc python3-dev musl-dev jpeg-dev zlib-dev libjpeg -RUN pip3 install --no-cache --upgrade pip setuptools +RUN pip3 install --upgrade pip3 wheel setuptools RUN addgroup -S docker ENV PYTHONUNBUFFERED 1 @@ -14,5 +14,3 @@ WORKDIR /usr/src/app/ COPY . /usr/src/app/ RUN pip3 install -r requirements.txt - -EXPOSE 8000 diff --git a/nginx.conf b/nginx.conf index 9894ac8..f96bb6f 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,15 +1,16 @@ -events { - worker_connections 1024; +upstream app { + server 127.0.0.1:8000; } -http { - upstream app_server { - server localhost:8000 fail_timeout=0; - } - server { - listen 80; - location / { - proxy_pass http://app_server; - } +server { + listen 80; + + location / { + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + proxy_redirect off; + + proxy_pass http://app; } + } \ No newline at end of file