dwebsocket+uwsgi+nginx

983 단어
  • django의settings 설정
  • WEBSOCKET_FACTORY_CLASS = 'dwebsocket.backends.uwsgi.factory.uWsgiWebSocketFactory'
    ...
    WSGI_APPLICATION = 'MsgCenter.wsgi.application'
    
  • uwsgi.ini 구성
  • ...
    # ... with appropriate permissions - may be needed
    chmod-socket    = 664
    # clear environment on exit
    vacuum          = true
    enable-threads  = true
    
    http-websockets = true
    ugreen = ''
    http-timeout = 300
    async = 30
    
    ignore-sigpipe = true
    ignore-write-errors = true
    disable-write-exception = true
    ...
    
  • nginx.conf 구성
  • server {
        listen      8001;
        server_name localhost;
        charset     utf-8;
     
        client_max_body_size 75M;
     
        location / {
            uwsgi_pass  127.0.0.1:8000;
            include     uwsgi_params;
            proxy_redirect off;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }
    }
    

    좋은 웹페이지 즐겨찾기