Python uwsgi断裂管道-django,nginx

Python uwsgi断裂管道-django,nginx,python,django,nginx,tastypie,uwsgi,Python,Django,Nginx,Tastypie,Uwsgi,我在uwsgi中随机(并且一直)得到一个破裂的管道。。。如下所示。你知道是什么原因造成的吗?我如何调试 我在django(tastypie)、uwsgi、nginx上,在aws(Ubuntu14.04)上运行m3.medium 我注意到任何相关的数字也降到了一个很低的数字。注意这里的第二个请求——2/1303。此请求超时 [pid: 1516|app: 0|req: 624/1302] 10.0.0.204 () {42 vars in 1039 bytes} [Wed Jun 18 16:41

我在uwsgi中随机(并且一直)得到一个破裂的管道。。。如下所示。你知道是什么原因造成的吗?我如何调试

我在django(tastypie)、uwsgi、nginx上,在aws(Ubuntu14.04)上运行m3.medium

我注意到任何相关的数字也降到了一个很低的数字。注意这里的第二个请求——2/1303。此请求超时

[pid: 1516|app: 0|req: 624/1302] 10.0.0.204 () {42 vars in 1039 bytes} [Wed Jun 18 16:41:09 2014] GET /api/v1/clock/?format=json => generated 1298 bytes in 12 msecs (HTTP/1.1 200) 4 headers in 119 bytes (1 switches on core 0)
[pid: 1512|app: 0|req: 2/1303] 10.0.0.204 () {42 vars in 1039 bytes} [Wed Jun 18 16:41:10 2014] GET /api/v1/clock/?format=json => generated 1298 bytes in 50 msecs (HTTP/1.1 200) 4 headers in 119 bytes (1 switches on core 0)
[pid: 1516|app: 0|req: 625/1304] 10.0.0.159 () {42 vars in 1039 bytes} [Wed Jun 18 16:41:29 2014] GET /api/v1/clock/?format=json => generated 1298 bytes in 17 msecs (HTTP/1.1 200) 4 headers in 119 bytes (1 switches on core 0)
[pid: 1517|app: 0|req: 668/1305] 10.0.0.204 () {46 vars in 908 bytes} [Wed Jun 18 16:41:31 2014] GET /api/v1/clock/ => generated 1298 bytes in 18 msecs (HTTP/1.0 200) 4 headers in 119 bytes (1 switches on core 0)
更新:nginx.conf

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

events {
    worker_connections 1024;
    # multi_accept on;
}

http {

    client_body_timeout 12;
    client_header_timeout 12;
    keepalive_timeout 15;
    send_timeout 10;
    client_max_body_size 8m;

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    types_hash_max_size 2048;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # Logging Settings
    ##

    #access_log off;
    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;
    gzip_disable "msie6";

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    ##
    # nginx-naxsi config
    ##
    # Uncomment it if you installed nginx-naxsi
    ##

    #include /etc/nginx/naxsi_core.rules;

    ##
    # nginx-passenger config
    ##
    # Uncomment it if you installed nginx-passenger
    ##

    #passenger_root /usr;
    #passenger_ruby /usr/bin/ruby;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}
此特定站点的虚拟配置

upstream django {
    server unix:/tmp/domain.sock;
}

server {
    listen 80;

    server_name domain.com;

    return 301 https://$host$request_uri;
}

server {
    listen 443;
    server_name domain.com;

    location /static {
        alias /home/ubuntu/domain/static;
    }

    location / {
        proxy_set_header X-Forwarded-Proto https;

        uwsgi_pass django;
        include /etc/nginx/uwsgi_params;
    }
}
uwsgi配置(附庸)

在启动时启动uwsgi进程的/etc/rc.local的竞争

#!/bin/sh -e
/usr/local/bin/uwsgi --emperor /etc/uwsgi/vassals --logto /var/log/uwsgi/emperor.log
exit 0

<>你可以安全地忽略它们,它们是由客户端(或NGNIX)在请求中间断开的。由于响应时间非常低,很可能是客户端断开连接。顺便说一句,发布您的nginx和uWSGI配置以确保安全。

谢谢您——用配置更新了帖子。如果有什么事情看起来不正常,你能告诉我吗?此服务器仍然存在非常奇怪/间歇性的连接问题。碰巧是internet连接不好。非常感谢。
[uwsgi]
env             = DEBUG=False
env             = DB_ENVIRONMENT=production
env             = NEW_RELIC_CONFIG_FILE=config/newrelic.ini
env             = NEW_RELIC_ENVIRONMENT=production
chdir           = /home/ubuntu/domain
home            = /home/ubuntu/domain/venv
module          = domain.wsgi
processes       = 20
uid             = www-data
gid             = www-data
chmod-socket    = 666
socket          = /tmp/domain.sock
stats           = /tmp/domain.stats.sock
#!/bin/sh -e
/usr/local/bin/uwsgi --emperor /etc/uwsgi/vassals --logto /var/log/uwsgi/emperor.log
exit 0