Saya menemukan masalahnya.
Soket [runserver] saya (app.sock) harus diarahkan ke upstream django
dan soket [wsserver] saya (Django.sock) harus diarahkan ke location /ws/
seperti ini:
upstream django {
server unix:/opt/django/app.sock;
}
server {
listen 80 default_server;
charset utf-8;
client_max_body_size 20M;
sendfile on;
keepalive_timeout 0;
large_client_header_buffers 8 32k;
location /media {
alias /opt/django/app/media/media;
}
location /static {
alias /opt/django/app/static;
}
location / {
include /opt/django/uwsgi_params;
}
location /ws/ {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://unix:/opt/django/django.sock;
proxy_buffers 8 32k;
proxy_buffer_size 64k;
}
}