0
votes

Mine nginx.conf file

worker_processes 1;
error_log stderr notice;

events {
    worker_connections 1024;
}

http {

  types_hash_max_size 2048;

  upstream cabot_app {
    server cabot:5000 max_fails=3 fail_timeout=3s;
  }

  server {
    listen 8088;

    location / {
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_redirect off;
      proxy_pass http://cabot_app;
     }

    location /static/ {
      include       /etc/nginx/mime.types;
      default_type  application/octet-stream;
      root /code/;
    }
  }
}

and docker-compose yaml file

redis:
    image: redis
    restart: always

  db:
    image: postgres
    restart: always
    ports:
      - "5432:5432"
    restart: always
    environment:
      POSTGRES_PASSWORD: test
      POSTGRES_USER: test
      POSTGRES_DB: tests

  cabot:
      build: .
      restart: always
      links:
          - redis:celerybroker
          - db
          - redis
      env_file: cabot_env
      ports:
          - "5000:5000"

  nginx:
    image: nginx
    ports:
       - "9999:8088"
    links:
       - cabot
    volumes_from:
       - cabot
    volumes:
       - ./nginx.conf:/etc/nginx/nginx.conf:ro
       - ./cabot/static/:/code/static:ro

Temporarily I am getting 502 bad gateway. its goes off when I reload the page.

Nginx logs files gives:

/code/static/CACHE/css/base.36481a0991d5.css" failed (2: No such file or directory)

1
I am also getting : """upstream prematurely closed connection while reading response header from upstream, client: server:""" - pythonhmmm

1 Answers

0
votes

I'm not familiar with cabot. But from the error log it looks like cabot is using django-compressor (not sure). And the CACHE files by django-compressor is not generated yet.

You may need to add an additional step to generate the compressed css/js files.

python manage.py compress