[uWSGI] Fastcgi app has stopped working w/ latest version

Roberto De Ioris roberto at unbit.it
Sat Oct 5 06:09:38 CEST 2013

> Hello, folks--
> First of all, being new here, let me say thanks to the development
> team for all their hard work on uWSGI!
> So, I'm having the following issue ...
> I have a FastCGI app that I am managing with uWSGI. My primary web
> server is Nginx, and I am using Arch Linux for my development box and
> FreeBSD 7.2 for production. The app itself is a native code executable
> written in Chicken Scheme. It uses a Fastcgi library which is a very
> basic wrapper around the FCGIX API of the standard fcgi C library.
> Also, in case it matters, my app serves only dynamic content. All
> static files are handled directly by Nginx and served from the docroot
> (i.e. there are no 'alias' directives). I've had this app running on
> my production server for about 6 months with no serious issues; during
> that time I think I've upgraded Nginx and uWSGI at least a couple of
> times; the current versions are Nginx 1.4.1 and uWSGI 1.9.12.
> Anyway, I have encountered a new problem on my development system. In
> the course of developing a new app using the same technologies, I
> decided to verify that the existing app was still working. Nginx was
> up-to-date (v. 1.4.2), but I noticed I had an old version of uWSGI
> installed (1.2.6), so I decided to upgrade it before proceeding. I
> upgraded to 1.9.17, and I find that in fact my app does not work now.
> For any URI that is supposed to be handled by my app, I get an Nginx
> error message saying, "upstream prematurely closed connection while
> reading response header from upstream ..."
> I am using the following script to run my app:
> #!/bin/sh
> export UWSGI_PROTOCOL=fastcgi
> export UWSGI_UID=http
> export UWSGI_GID=http
> export UWSGI_PIDFILE=/run/yanagi_dev.pid
> export UWSGI_EXEC_AS_USER=/srv/http/studioyanagi.com/dynamic/yanagi-web
> export UWSGI_SOCKET=
> export UWSGI_MASTER=1
> exec /usr/bin/uwsgi
> This is the development version. The production version is the same
> except for the paths, the UID and GID, and the logging option (using
> syslog on the prod server).
> This is currently working on the production server, but has stopped
> working on the dev box.
> The relevant portion of my Nginx configuration is:
>    location ~
> ^(/|/about|/contact|/wheretobuy|/custom|/gallery|/gallery-nojs|/news|/gallery.json|/news.json)$
> {
>         include         uwsgi_params;
>         uwsgi_pass ;
>    }

I am not sure to understand your old setup, but setting protocolo to
'fastcgi' in uWSGI forces it to use the fastcgi protocol for the port 3121
while in nginx you are using the uwsgi protocol (uwsgi_pass).

Just remove UWSGI_PROTOCOL=fastcgi or change nginx to use the fastcgi

Roberto De Ioris

More information about the uWSGI mailing list