title: can't access to server. Nginx is not working on docker, Django Project, Daphne, Gunicorn, Redis
body: <p>I am configuring Nginx for ASGI(with Daphne), WSGI(Gunicorn) as well as Redis and Postgres to deploy Django Project.
  it was working find but all of sudden the browser is not able to access the server(172.0.0.1:1337) after set up django settings.py for <code>check --deploy</code> with following Nginx logs, I don't think it can cause problems because I just added some configurations in local compose file but compose.prod.yml for production.</p>
  <p>I didn't set the <code>.sh</code> file yet, every pages that I googled for below messages mention those files for running docker-compose in production. would it be a problem not configuring that <code>.sh</code> file? but It was working even without the file.</p>
  <p>which part should I check for this problem and any configurations that I need to add?</p>
  <p>Thanks in advance!
  if more information needed, let me know.</p>
  <pre class="lang-sh prettyprint-override"><code>nginx       | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
  nginx       | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
  nginx       | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
  nginx       | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
  nginx       | 10-listen-on-ipv6-by-default.sh: /etc/nginx/conf.d/default.conf is not a file or does not exist, exiting
  nginx       | /docker-entrypoint.sh: Configuration complete; ready for start up
  </code></pre>
  <p><strong>nginx Dockerfile</strong></p>
  <pre><code>FROM nginx:1.19.0-alpine
  
  RUN rm /etc/nginx/conf.d/default.conf
  COPY nginx.conf /etc/nginx/conf.d
  </code></pre>
  <p>#########</p>
  <p><strong>EDIT</strong>
  ** here I changed 2nd line <code>COPY ./nginx.conf /etc/nginx/conf.d/default.conf</code> and now nginx logs display like below**</p>
  <pre class="lang-sh prettyprint-override"><code>nginx       | 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
  nginx       | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version
  </code></pre>
  <p>#########</p>
  <p><strong>Nginx.conf</strong></p>
  <pre><code>upstream web {
      server web:8000 fail_timeout=0;
  }
  upstream daphne {
      server daphne:8001 fail_timeout=0;
  }
  
  
  server {
  
      listen 80;
  
      location / {
          proxy_pass http://web;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Host $host;
          proxy_redirect off;
      }
  
      location /ws/ {
          proxy_pass http://daphne;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Host $host;
          proxy_redirect off;
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection &quot;upgrade&quot;;
      }
  
      location /staticfiles/ {
          alias /Users/kz/Desktop/projects/community_app/staticfiles/;
      }
      location /media/ {
          alias /Users/kz/Desktop/projects/community_app/media/;
      }
  
  }
  </code></pre>
  <p><strong>docker-compose.prod.yml</strong></p>
  <pre class="lang-yaml prettyprint-override"><code>version: '3.8'
  
  services: 
    web:
      build: .
      container_name: web
      command: gunicorn config.wsgi:application --bind 0.0.0.0:8000
      volumes: 
        - static_volume:/address/
        - media_volume:/address/
      expose:
        - 8000
      depends_on: 
        - commu_db
        - redis
      environment: 
        - &quot;DJANGO_SETTINGS_MODULE=config.settings&quot;
        - &quot;DJANGO_SECRET_KEY=##&quot;
    
    daphne:
      build: .
      restart: always
      container_name: daphne
      command: daphne -b 0.0.0.0 -p 8001 config.asgi:application
      volumes: 
        - static_volume:/address/
        - media_volume:/address/
      expose:
        - 8001
      # ports: 
      #   - &quot;8001:8001&quot;
      environment: 
        - &quot;DJANGO_SETTINGS_MODULE=config.settings&quot;
        - &quot;DJANGO_SECRET_KEY=###&quot;
      depends_on:
        - redis
        - commu_db
        - web
  
    nginx:
      build: ./nginx
      container_name: nginx
      volumes: 
        - static_volume:/address/
        - media_volume:/address/
      ports:
        - 1337:80
      depends_on:
        - web
        - daphne
    
    commu_db:
      image: postgres:13
      container_name: postgres
      volumes: 
        - postgres_test_data:/var/lib/postgresql/data/
      ports: 
        - 5433:5432
      environment: 
        - &quot;POSTGRES_PASSWORD=postgres&quot;
  
    redis:
      container_name: redis
      hostname: comm_redis
      restart: always
      image: redis:5
      ports:
        - &quot;6379:6379&quot;
      
  
  volumes: 
    postgres_test_data:
    static_volume:
    media_volume:
  </code></pre>