title: configuring django with nginx gunicorn on docker
body: <p>Good day, I am new to docker and I have a Django app I will like to dockerize, I have searched for tutorials to help me set up my Django app with docker, I followed this article here on test-driven <a href="https://testdriven.io/blog/dockerizing-django-with-postgres-gunicorn-and-nginx/" rel="nofollow noreferrer">https://testdriven.io/blog/dockerizing-django-with-postgres-gunicorn-and-nginx/</a>. I get issues making nginx work with my app. here is my code.</p>
  <p>my apps docker file:</p>
  <pre><code>FROM python:3.8-alpine
  
  ENV PATH=&quot;/scripts:${PATH}&quot;
  
  COPY ./requirements.txt /requirements.txt
  RUN pip install -r /requirements.txt
  
  
  RUN mkdir /app
  COPY ./testdocker /app
  WORKDIR /app
  COPY ./scripts /scripts
  
  RUN chmod +x /scripts/*
  
  RUN mkdir -p /vol/web/media
  RUN mkdir -p /vol/web/static
  
  RUN adduser -D user
  RUN chown -R user:user /vol
  
  RUN chmod -R 755 /vol/web
  
  USER user
  
  nginx docker file:
  
  FROM nginx:1.19.3-alpine
  
  RUN rm /etc/nginx/conf.d/default.conf
  COPY ./nginx.conf /etc/nginx/conf.d
  
  RUN mkdir -p /vol/static
  
  my docker-compose file:
  
  version: '3.7'
  
  services:
      app:
          build:
              context: .
          command: sh -c &quot;gunicorn testdocker.wsgi:application --bind 0.0.0.0:8000&quot;
          volumes:
              - static_data:/vol/web
          expose:
              - &quot;8000&quot;
          environment: 
              - SECRET_KEY=MANME1233
              - ALLOWED_HOSTS=127.0.0.1, localhost
      
      nginx:
          build: 
              context: ./nginx
          volumes: 
              - static_data:/vol/static
          ports: 
              - &quot;8080:80&quot;
          depends_on:
              - app
  
  volumes: 
      static_data:
  
  
  my nginx conf file:
  
   upstream testapp {
       server app:8000;
   }
  
      server {
      listen 8080;
      server_name app;
      
      location / {
          proxy_pass http://testapp;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Host $host;
          proxy_redirect off;
      }
    
      location /static {
          alias /vol/static;
      }
  
  }
  </code></pre>
  <p>I can't seem to get nginx to reverse proxy to my web app, upon opening the URL on the browser I get a 404 bad request or address not found. please what am I doing wrong or not doing right?.</p>