调试uwsgi / nginx(适用于OpenBSD,不适用于Linux)

时间:2015-11-30 23:20:26

标签: python nginx uwsgi

我正在运行一段非常简单的python代码,它在OpenBSD下运行完美(使用httpd + uwsgi)。具有相同uwsgi配置的相同代码根本不在Linux下运行(使用nginx)。

代码为hereuwsgi.ini文件为here以及以下内容:

[uwsgi]
fastcgi-socket = 127.0.0.1:3031
uid = uwsgi
module = url_share
callable = parent_app
virtualenv = %d/venv
chdir = %d
# daemonize after loading app
daemonize2 = True

我假设问题出现在nginx中,这是我唯一能够控制的变化变量。它的配置也非常简单:

server {
        location /urlsh/ {
                include uwsgi_params;
                uwsgi_pass 127.0.0.1:3031;
        }

特别是,nginx的error_log是:

2015/11/30 23:03:32 [error] 27894#0: *1 upstream prematurely closed connection while reading response header from upstream, client: 192.168.1.107, server: , request: "GET /urlsh/ HTTP/1.1", upstream: "uwsgi://127.0.0.1:3031", host: "192.168.1.10"

使用网络浏览器打开页面后,这种情况恰好 8.1秒

    $ time curl 127.0.0.1/urlsh/
<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.2.1</center>
</body>
</html>

real    0m8.120s
user    0m0.060s
sys     0m0.020s

我的问题是:如何让uwsgi打印更多输出?

我试图查明问题的事情:

  • 在python代码中添加print语句:它们被打印,因此应用程序运行
  • 将应用程序作为独立的Python程序运行:Linux下没问题
  • 删除nginx,安装默认配置

系统是Linux Raspbian 7.8&#34; Wheezy&#34;。 Python是2.7.3,uwsgi(通过pip安装)是2.0.11.2。

0 个答案:

没有答案