相关疑难解决方法(0)

Gunicorn Nginx超时问题

我在gunicorn + nginx上运行django.我正面临文件上传的问题.实际上上传工作正常,但枪炮超时因此导致这在nginx:

2011/07/25 12:13:47 [error] 15169#0: *2317 upstream timed out (110: Connection timed out) while reading response header from upstream, client: IP-ADDRESS, server: SERVER, request: "GET /photos/events/event/25 HTTP/1.1", upstream: "http://127.0.0.1:29000/photos/events/event/25", host: "HOST", referrer: "REFERER_ADDRESS"
Run Code Online (Sandbox Code Playgroud)

如果我刷新页面,我可以看到所有照片都上传得很好.问题是它会导致超时,从而给人一种上传不起作用的印象.

这是我的枪炮:

bind = "127.0.0.1:29000"
logfile = "/path/to/logs/gunicorn.log"
workers = 3
Run Code Online (Sandbox Code Playgroud)

我尝试更改超时,但它没有用.

django nginx gunicorn

58
推荐指数
3
解决办法
4万
查看次数

nginx uwsgi websockets 502 Bad Gateway上游过早关闭连接,同时从上游读取响应头

我已经在这个问题上敲打了好几天,终于到了一堵砖墙.

我一直试图让我的堆栈运行:

http://django-websocket-redis.readthedocs.org/en/latest/running.html#django-with-websockets-for-redis-behind-nginx-using-uwsgi

我一直在看其他一些SO这样的文章:

nginx - uWSGI HTTP + websocket配置

他们似乎遇到了类似的问题,但解决方案对我不起作用.

基本上,每当我尝试启动我的uWSGI进程时,我都会遇到nginx 502坏网关屏幕.根据文档中的说明,我有两个单独的uwsgi进程在运行.

当我运行websocket uwsgi实例时,我得到以下内容:

*** running gevent loop engine [addr:0x487690] ***
[2015-05-27 00:45:34,119 wsgi_server] DEBUG: Subscribed to channels: subscribe-broadcast, publish-broadcast
Run Code Online (Sandbox Code Playgroud)

这告诉我,uwsgi实例运行正常.然后我运行我的下一个uwsgi进程,没有错误记录那里...

当我导航到浏览器中的页面时,该页面会挂起几秒钟,然后才能获得502 Bad Gateway屏幕.

根据NGINX日志,NGINX说:

2015/05/26 22:46:08 [error] 18044#0: *3855 upstream prematurely closed connection while reading response header from upstream, client: 192.168.59.3, server: , request: "GET /chat/ HTTP/1.1", upstream: "uwsgi://unix:/opt/django/django.sock:", host: "192.168.59.103:32768"
Run Code Online (Sandbox Code Playgroud)

这是我尝试在Web浏览器中访问该页面时获得的唯一错误日志.

任何人的想法???

以下是我的一些配置文件:


nginx.conf

user www-data;
worker_processes 4;
pid /run/nginx.pid;

events {
    worker_connections 768;
}

http { …
Run Code Online (Sandbox Code Playgroud)

django nginx websocket redis uwsgi

19
推荐指数
1
解决办法
2万
查看次数

标签 统计

django ×2

nginx ×2

gunicorn ×1

redis ×1

uwsgi ×1

websocket ×1