【问题标题】:Cabot - 502 bad gateway errorCabot - 502 错误网关错误
【发布时间】:2016-10-25 09:10:57
【问题描述】:

挖掘 nginx.conf 文件

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/;
    }
  }
}

和 docker-compose yaml 文件

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

我暂时收到 502 bad gateway。当我重新加载页面时它会熄灭。

Nginx 日志文件给出:

/code/static/CACHE/css/base.36481a0991d5.css" 失败(2:没有这样的文件或目录)

【问题讨论】:

  • 我也得到:"""上游过早关闭连接,同时从上游读取响应头,客户端:服务器:"""

标签: django nginx


【解决方案1】:

我不熟悉cabot。但从错误日志看来,cabot 正在使用django-compressor(不确定)。并且django-compressorCACHE 文件尚未生成。

您可能需要添加一个额外的步骤来生成压缩的 css/js 文件。

python manage.py compress

【讨论】:

  • 压缩似乎工作正常。连接到上游客户端时出现错误“connect() failed (111: Connection refused)”
猜你喜欢
  • 2017-03-28
  • 1970-01-01
  • 1970-01-01
  • 2017-07-07
  • 2022-01-07
  • 2021-07-21
  • 2011-05-14
  • 2016-07-04
  • 2019-06-05
相关资源
最近更新 更多