Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production deployment - nginx & uWSGI #27

Closed
Glideh opened this issue Apr 14, 2014 · 6 comments
Closed

Production deployment - nginx & uWSGI #27

Glideh opened this issue Apr 14, 2014 · 6 comments

Comments

@Glideh
Copy link

Glideh commented Apr 14, 2014

I've been able to successfully use this great library with my dev server.
Now I'm trying to install a server environment on my local machine (before the true one).
I configured 2 vassals in emperor mode for both my project and its websocket applications.
The one for my project works fine, but I seem to receive only HTTP requests on the websocket one (invalid request block size: 21573 (max 4096))
Here is my websocket vassal:

[uwsgi]

chdir           = /my/project/path
module          = wsgi_websocket
virtualenv      = /my/virtualenv/path

workers         = 2
socket          = /tmp/%n.sock
gevent          = 100
http-websockets = true
vacuum          = true

So my current issue is my websocket receives only invalid request block size: 21573 (max 4096) for each ws: queries
Could somebody help me to debug that ?

@jrief
Copy link
Owner

jrief commented Apr 14, 2014

Typically this error message appears, if you try to send WSGI instead of HTTP, so probably you misconfigured you nginx.
This is my settings

nginx

    ....
       location /ws/ {
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_pass http://unix:/path/to/web.socket;
        }
    ....

uwsgi

[default]
umask = 002
virtualenv = /web/production/virtualenvs/project
master = true
no-orphans = true
uid = jrief
gid = developer
threads = 1
env = DJANGO_SETTINGS_MODULE=project.settings

[runserver]
ini = :default
socket = django.socket
module = wsgi_django:application
buffer-size = 32768
processes = 4

[wsserver]
ini = :default
http-socket = web.socket
module = wsgi_websocket:application
processes = 2
http-websockets = true
gevent = 1000

@Glideh
Copy link
Author

Glideh commented Apr 14, 2014

Thank you for your answer, my nginx config seems to be the same
(I just copy/pasted it and changed the socket).
I'm going to try a simple copy/paste of your wsgi config.

@jrief
Copy link
Owner

jrief commented Apr 14, 2014

BTW, which version of NGiNX are you using?

@Glideh
Copy link
Author

Glideh commented Apr 14, 2014

1.2.6

@jrief
Copy link
Owner

jrief commented Apr 14, 2014

Please Read The Docs:
"Assure that you use NGiNX version 1.4 or later, since earlier versions have no support for Websockets. "

@jrief jrief closed this as completed Apr 14, 2014
@Glideh
Copy link
Author

Glideh commented Apr 14, 2014

Oups that was quite simple, sorry.
I saw that but didn't check my version.
Somehow still hoping to have recent pakages from Debian/Ubuntu ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants