小编Асх*_*лов的帖子

无法使用django-channels,docker上的nginx作为服务连接到websocket

我正在使用docker compose来构建一个django,nginx作为服务的项目.当我启动daphne服务器,并且客户端尝试连接到websocket服务器时,我收到此错误:

*1 recv() failed (104: Connection reset by peer) while reading response header from upstream
Run Code Online (Sandbox Code Playgroud)

客户端显示了这一点

failed: Error during WebSocket handshake: Unexpected response code: 502
Run Code Online (Sandbox Code Playgroud)

这是我的docker-compose.yml

version: '3'
services:
  nginx:
    image: nginx
    command: nginx -g 'daemon off;'
    ports:
      - "1010:80"
    volumes:
      - ./config/nginx/nginx.conf:/etc/nginx/nginx.conf
      - .:/makeup
    links:
      - web
  web:
    build: .
    command: /usr/local/bin/circusd /makeup/config/circus/web.ini
    environment:
      DJANGO_SETTINGS_MODULE: MakeUp.settings
      DEBUG_MODE: 1
    volumes:
      - .:/makeup
    expose:
      - '8000'
      - '8001'
    links:
      - cache
    extra_hosts:
      "postgre": 100.73.138.65
Run Code Online (Sandbox Code Playgroud)

Nginx的:

server {
        listen 80;
        server_name …
Run Code Online (Sandbox Code Playgroud)

django nginx docker circusd devops

6
推荐指数
1
解决办法
1301
查看次数

标签 统计

circusd ×1

devops ×1

django ×1

docker ×1

nginx ×1