nginx - uWSGI HTTP + websocket config

女生的网名这么多〃 提交于 2019-12-11 12:41:29

问题


I'm trying to configure uWSGI for an application (Django) that uses http & websocket queries.
Here is the uWSGI ini file that I did to achieve this

[uwsgi]
ini = :runserver
ini = :wsserver

[default]
userhome = /home/myuser
virtualenv = %(userhome)/.virtualenvs/myapp
chdir = %(userhome)/Documents/myapp
master = true
no-orphans = true
uid = www-data
gid = www-data
threads = 1
env = DJANGO_SETTINGS_MODULE=myapp.settings
vacuum = true

[runserver]
ini = :default
socket = /tmp/myapp.sock
module = wsgi_django
buffer-size = 32768
processes = 4

[wsserver]
ini = :default
http-socket = /tmp/myapp_websocket.sock
module = wsgi_websocket
processes = 2
http-websockets = true
gevent = 1000

As you can see I'm including both my services runserver & websocket from uwsgi.
I see nginx and uwsgi communicating between them but nginx always returns me

NetworkError: 502 Bad Gateway

I see no error in uwsgi log but if I comment one of them, the other works.

Can somebody help me to debug that ?


回答1:


I ended up by using 2 different files and repeating the common settings on each



来源:https://stackoverflow.com/questions/23077932/nginx-uwsgi-http-websocket-config

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!