Nginx 塔架、uWSGI和httplib导致上游过早关闭连接错误

Nginx 塔架、uWSGI和httplib导致上游过早关闭连接错误,nginx,pylons,uwsgi,httplib,Nginx,Pylons,Uwsgi,Httplib,我有一个pylons应用程序,我正试图用uWSGI在NGINX后面运行。应用程序使用httplib发出GET请求。在paster下测试时,应用程序通常会从GET请求接收数据,但在uWSGI后面设置数据后,我的nginx日志中出现以下错误: 2013/09/20 21:52:07 [error] 3920#0: *10 upstream prematurely closed connection while reading response header from upstream, client

我有一个pylons应用程序,我正试图用uWSGI在NGINX后面运行。应用程序使用httplib发出GET请求。在paster下测试时,应用程序通常会从GET请求接收数据,但在uWSGI后面设置数据后,我的nginx日志中出现以下错误:

2013/09/20 21:52:07 [error] 3920#0: *10 upstream prematurely closed connection while reading response header from upstream, client: ***, server: ***.com, request: "GET /getElevation?X_Value=-105.61019897460938&Y_Value=40.24959460394122 HTTP/1.1", upstream: "uwsgi://unix:///tmp/uwsgi.maps.sock:"
在uwsgi日志中:

Traceback (most recent call last):
  File "/root/.virtualenvs/maps/lib/python2.6/site-packages/Paste-1.7.5.1-py2.6.egg/paste/cascade.py", line 117, in __call__
    v = app(environ_copy, repl_start_response)
  File "/root/.virtualenvs/maps/lib/python2.6/site-packages/Paste-1.7.5.1-py2.6.egg/paste/urlparser.py", line 446, in __call__
    filename = request.path_info_pop(environ)
  File "/root/.virtualenvs/maps/lib/python2.6/site-packages/Paste-1.7.5.1-py2.6.egg/paste/request.py", line 309, in path_info_pop
    environ['SCRIPT_NAME'] += '/'
KeyError: 'SCRIPT_NAME'
[pid: 3897|app: 0|req: 1/4] **** () {44 vars in 1228 bytes} [Fri Sep 20 21:52:07 2013] GET /getElevation?X_Value=-105.61097145080566&Y_Value=40.24500880734505 => generated 0 bytes in 1 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)
...The work of process 3897 is done. Seeya!
worker 2 killed successfully (pid: 3897)
Respawned uWSGI worker 2 (new pid: 3925)
我认为这可能是超时问题,但我为uwsgi设置了以下内容:

socket-timeout = 15
http-timeout = 15
harakiri = 60
我肯定我在uWSGI配置中遗漏了一些东西。有人能告诉我正确的方向吗?

您的应用程序(挂架)需要SCRIPT\u NAME变量:

环境['SCRIPT_NAME']+='/'

KeyError:“脚本名称”

只需告诉nginx将其传递给uWSGI:

uwsgi_param SCRIPT_NAME "";