1

I am trying to set up a really simple uWSGI + nginx project. I ran into the following problems

  1. wsgi.input appears to be empty (which I found out trying to get POST variables)

  2. curl http://localhost:8080/parsings works fine, but curl http://localhost:8080/parsings --header "Content-Length:1" hangs and then returns curl: (52) Empty reply from server

  3. Nothing appears on nginx error.log. uWSGI does not log anything either. It looks as if the request does not go anywhere near the server.

Here are the configs

nginx.conf

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

events {
    worker_connections 768;
}

http {
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;

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

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

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

    gzip on;
    gzip_disable "msie6";

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

    proxy_buffers 8 32k;
    proxy_buffer_size 64k;
    proxy_connect_timeout   10;
    proxy_send_timeout      15;
    proxy_read_timeout      20;
}

sites-enabled/mysite

server {
    listen 127.0.0.1:8080;
    server_name myproject.local;
    client_max_body_size 2M;

    location / {
        include         uwsgi_params;
        uwsgi_read_timeout 300;
        uwsgi_pass      unix:///tmp/my_project.sock;
    }
}

uwsgi.ini

[uwsgi]
module = wsgi:application

master = true
processes = 5
static-map = /static/=/home/breln/projects/myproject/static
socket = /tmp/my_project.sock
chmod-socket = 777
chown-socket = www-data
vacuum = true

die-on-term = true

Nginx is 1.11.8 (same problem appeared with 1.10.2). uWSGI is 2.0.14

Any hints appreciated.

breln
  • 31
  • 6

1 Answers1

0

Probably related to uWSGI not buffering/reading the POST data from Nginx, unless your WSGI app tries to use the POST data in the request handler:

Nginx connection reset, response from uWsgi lost

Alan Hamlett
  • 3,160
  • 1
  • 23
  • 23