dwebsocket+uwsgi+nginx

  • 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";
    }
}

你可能感兴趣的:(dwebsocket+uwsgi+nginx)