Forum: NGINX Time out errors using uwsgi with ngnix on debian 7 (wheezy)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I
unfortunately do not have the time to support and maintain the forum any
more. Please see rubyonrails.org/community and ruby-lang.org/en/community
for other Rails- und Ruby-related community platforms.

I've installed nginx via apt, using the nginx stable pkg as described
here:
http://nginx.org/en/linux_packages.html#stable
It works perfectly for serving static files using the default
configuration.
Next, I installed uwsgi from source, as described here:
https://pypi.python.org/pypi/uWSGI/1.2.3
When I do the steps in the python quickstart guide --
http://uwsgi-docs.readthedocs.org/en/latest/WSGIqu... -- and
open
my browser to localhost:9090, everything works as expected.
When I change the nginx config file to use uwsgi_pass to localhost:9090
as
described here --
http://uwsgi-docs.readthedocs.org/en/latest/WSGIqu...
however, I get time out errors:
> upstream timed out (110: Connection timed out) while reading response
header from upstream
It is as though nginx is *not* passing those requests to the uwsgi
process
(which is still running).
Here is the content of server{ } inside the nginx config file:
location / {
include uwsgi_params;
uwsgi_pass localhost:9090;
}
Any ideas on what the problem might be?

Hello!
On Wed, Jan 08, 2014 at 08:15:47PM -0500, Denis Papathanasiou wrote:
> my browser to localhost:9090, everything works as expected.> (which is still running).>> Here is the content of server{ } inside the nginx config file:>> location / {> include uwsgi_params;> uwsgi_pass localhost:9090;> }>> Any ideas on what the problem might be?
If you are able to connect to localhost:9090 with your browser,
you are likely using native HTTP support in your uWSGI server.
The "uwsgi_pass" directive assumes uwsgi protocol though, which is
different.
You should either reconfigure uWSGI server to work via uwsgi, or
instruct nginx to talk via HTTP (i.e., use "proxy_pass" instead of
"uwsgi_pass").
--
Maxim Dounin
http://nginx.org/

Maxim,
Thank you for your reply.
On Thu, Jan 9, 2014 at 10:03 AM, Maxim Dounin <mdounin@mdounin.ru>
wrote:
> [snip]>> If you are able to connect to localhost:9090 with your browser,> you are likely using native HTTP support in your uWSGI server.>
Yes, I am starting the uwsgi process like this, using the --http flag:
uwsgi --http :9090 --wsgi-file foobar.py --master --processes 4
--threads 2
> The "uwsgi_pass" directive assumes uwsgi protocol though, which is> different.>> You should either reconfigure uWSGI server to work via uwsgi, or>
Ah, I see, I should use the --socket option instead, like this:
uwsgi --socket 127.0.0.1:9090 --wsgi-file foobar.py --master --processes
4
--threads 2
Thank you for clarifying that; it *is* in the uwsgi docs I quoted
earlier,
but it is a subtle point under the "quickstart" section, and I had
missed
it.
> instruct nginx to talk via HTTP (i.e., use "proxy_pass" instead of> "uwsgi_pass").>
I see: I could use "proxy_pass" and keep --http when I start uwsgi.
Thank you, that was very helpful!