nginx+uwsgi的一個配置錯誤

  • 3283
  • 0

摘要:nginx+uwsgi的一個配置錯誤

最近配了一个python服务器跑自己写的一个web应用,配置完成之后,发现安装完成之后在某些情况下,nginx会出现502错误:502 Bad Gateway。

查看nginx和uwsgi日志分别表述如下:


2013/01/26 21:56:10 [error] 487#0: *118 upstream prematurely closed connection while reading response header from upstream, client: xxxx.64.xxx.xxx, server: xxxx.me, request: "GET /api/?xxx=xxx HTTP/1.1",upstream: "uwsgi://127.0.0.1:9001", host: "xxxx.me"

[pid: 1270|app: 0|req: 4/5] xxx.64.xxx.xx () {38 vars in 737 bytes} [Sat Jan 26 21:46:51 2013] GET /api/?xxx=xxx => generated 0 bytes in 2 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)
[pid: 1270|app: 0|req: 5/6] xxx.64.xxx.xx () {38 vars in 602 bytes} [Sat Jan 26 21:46:51 2013] GET /favicon.ico => generated 238 bytes in 1 msecs (HTTP/1.1 404) 2 headers in 72 bytes (1 switches on core 0)
invalid request block size: 65524 (max 4096)...skip
Sat Jan 26 21:50:25 2013 - error parsing request

错误一方面是代码有问题导致错误输出无法正确输出,另外一个是缓冲区大小导致的,但是不知道为何网上很难搜索得到,经常见到的情况是本地sock连接不上的情况

 

 

------------------------------

文章的授權使用CC BY-ND2.5協議。凡是標示“轉載”的文章,均來源於網絡並儘可能標註作者。如果有侵犯您的權益,請及時聯繫刪除或者署名、授權。


Gtalk/Email: cmd4shell  [at]  gmail.com