Nginx 连接重置,来自 uWsgi 的响应丢失 [英] Nginx connection reset, response from uWsgi lost
问题描述
我有一个通过 Nginx 和 uWsgi 托管的 django 应用程序.在某个非常简单的请求中,我得到了不同的 GET 和 POST 行为,这不应该是这种情况.
I have a django app hosted via Nginx and uWsgi. In a certain very simple request, I get different behaviour for GET and POST, which should not be the case.
uWsgi 守护进程日志:
The uWsgi daemon log:
[pid: 32454|app: 0|req: 5/17] 127.0.0.1 () {36 vars in 636 bytes} [Tue Oct 19 11:18:36 2010] POST /buy/76d4f520ae82e1dfd35564aed64a885b/a_2/10/ => generated 80 bytes in 3 msecs (HTTP/1.0 440) 1 headers in 76 bytes (0 async switches on async core 0)
[pid: 32455|app: 0|req: 5/18] 127.0.0.1 () {32 vars in 521 bytes} [Tue Oct 19 11:18:50 2010] GET /buy/76d4f520ae82e1dfd35564aed64a885b/a_2/10/ => generated 80 bytes in 3 msecs (HTTP/1.0 440) 1 headers in 76 bytes (0 async switches on async core 0)
Nginx 访问日志:
The Nginx accesslog:
127.0.0.1 - - [19/Oct/2010:18:18:36 +0200] "POST /buy/76d4f520ae82e1dfd35564aed64a885b/a_2/10/ HTTP/1.0" 440 0 "-" "curl/7.19.5 (i486-pc-linux-gnu) libcurl/7.19.5 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.15"
127.0.0.1 - - [19/Oct/2010:18:18:50 +0200] "GET /buy/76d4f520ae82e1dfd35564aed64a885b/a_2/10/ HTTP/1.0" 440 80 "-" "curl/7.19.5 (i486-pc-linux-gnu) libcurl/7.19.5 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.15"
Nginx 错误日志:
The Nginx errorlog:
2010/10/19 18:18:36 [error] 4615#0: *5 readv() failed (104: Connection reset by peer) while reading upstream, client: 127.0.0.1, server: localhost, request: "POST /buy/76d4f520ae82e1dfd35564aed64a885b/a_2/10/ HTTP/1.0", upstream: "uwsgi://unix:sock/uwsgi.sock:", host: "localhost:9201"
本质上,如果我使用 POST,Nginx 某处会丢失响应,如果我使用 GET,则不会.
In essence, Nginx somewhere loses the response if I use POST, not so if I use GET.
有人对此有所了解吗?
推荐答案
在进一步研究中幸运地发现 (http://answerpot.com/showthread.php?577619-Several%20Bugs/Page2) 后,我发现了一些帮助...
After a lucky find in further research (http://answerpot.com/showthread.php?577619-Several%20Bugs/Page2) I found something that helped...
在 Nginx conf 中提供 uwsgi_pass_request_body off;
参数解决了这个问题...
Supplying the uwsgi_pass_request_body off;
parameter in the Nginx conf resolves this problem...
这篇关于Nginx 连接重置,来自 uWsgi 的响应丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!