# Time out errors using uwsgi with ngnix on debian 7 (wheezy)

**URL:** <https://www.ruby-forum.com/t/time-out-errors-using-uwsgi-with-ngnix-on-debian-7-wheezy/238412>\
**Category:** NGINX\
**Created:** [January 9, 2014, 2:16am UTC](https://www.ruby-forum.com/t/time-out-errors-using-uwsgi-with-ngnix-on-debian-7-wheezy/238412 "2014-01-09T02:16:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [January 9, 2014, 2:16am UTC](https://www.ruby-forum.com/t/time-out-errors-using-uwsgi-with-ngnix-on-debian-7-wheezy/238412/1 "2014-01-09T02:16:17Z")

</div>

I’ve installed nginx via apt, using the nginx stable pkg as described  
here:  
[http://nginx.org/en/linux\_packages.html#stable](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](https://pypi.python.org/pypi/uWSGI/1.2.3)

When I do the steps in the python quickstart guide –  
[Quickstart for Python/WSGI applications — uWSGI 2.0 documentation](http://uwsgi-docs.readthedocs.org/en/latest/WSGIquickstart.html) – 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/WSGIquickstart.html#putting-behind-a-full-webserver--](http://uwsgi-docs.readthedocs.org/en/latest/WSGIquickstart.html#putting-behind-a-full-webserver--)  
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?

---

<div class="post-metadata">

**Author:** ![Denis\_Papathanasiou](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/fbc32d/32.png) [@Denis\_Papathanasiou](https://www.ruby-forum.com/u/Denis_Papathanasiou)\
**Post date:** [January 9, 2014, 4:03pm UTC](https://www.ruby-forum.com/t/time-out-errors-using-uwsgi-with-ngnix-on-debian-7-wheezy/238412/2 "2014-01-09T16:03:45Z")

</div>

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 D.  
[http://nginx.org/](http://nginx.org/)

---

<div class="post-metadata">

**Author:** ![Denis\_Papathanasiou](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/fbc32d/32.png) [@Denis\_Papathanasiou](https://www.ruby-forum.com/u/Denis_Papathanasiou)\
**Post date:** [January 9, 2014, 6:08pm UTC](https://www.ruby-forum.com/t/time-out-errors-using-uwsgi-with-ngnix-on-debian-7-wheezy/238412/3 "2014-01-09T18:08:49Z")

</div>

Maxim,

Thank you for your reply.

On Thu, Jan 9, 2014 at 10:03 AM, Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
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!
