Answer the question
In order to leave comments, you need to log in
How to make Nginx see Websocket?
There is an Ubuntu 16 server on which Django hangs along with the Django Channels module (web sockets). Installed gunicorn and nginx. I did everything except websocket. Errors 404, 502, Error in connection establishment: net::ERR_CONNECTION_REFUSED when connecting
Here is nginx.conf:
http {
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 3000;
root /home/azureuser/myapp/;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
autoindex on;
}
location / {
include proxy_params;
proxy_pass http://unix:/home/azureuser/myapp/myapp.sock;
}
location /api/chat/connect {
proxy_pass http://localhost:8000/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question