(111: Connection refused) while connecting to upstream NGINX Uwsgi

Francis Daly francis at daoine.org
Mon Sep 18 15:18:42 UTC 2017


On Mon, Sep 18, 2017 at 02:43:37AM -0400, sandyman wrote:

Hi there,

> I am trying to deploy my project to a production environment 

It looks like you have been trying lots of different things, and changing
some things each time.

It will probably be simpler for you if you find one tutorial on how to
use nginx to front django, and follow exactly that one. Do not try to
mix pieces from two or more until you understand what every config line
means; otherwise you will probably become confused.

> In terms of permissions I have read all the forums changed all permissions
> i.e. 777 etc etc
> srwxrwxrwx  uwsgi.sock  (owned by me full access ) !!
> I've checked over and over all the directory structures etc. Ive swtiched
> from unix sockets to http but still 
> no joy . 

First: decide do you want django to present itself on a unix socket,
or on a tcp port.

Next: decide do you want django to present itself as a uwsgi service,
or as a http service.

Then: configure django as the server, and configure nginx as the client
talking to that server.

> 2017/09/18 06:32:56 [error] 15451#0: *1 connect() to
> unix:////home/workspace/project//
> tmp/uwsgi.sock failed (111: Connection refused) while connecting to

There are lots of / characters there; they probably are not all needed.

> upstream, client: 1933
> .247.239.160, server: website.xyz, request: "GET / HTTP/1.0", upstream:
> "uwsgi://unix:////
> /home/workspace/project/tmp/uwsgi.sock:", host: "www.website.xyz"

That says that nginx thinks that django is presented as a uwsgi service,
on the unix socket /home/workspace/project/tmp/uwsgi.sock.

> [uwsgi]
> socket  = /home/workspace/project/uwsgi.sock
> protocol = http

That seems to say that django thinks that django presents itself as a
http service, on the unix socket /home/workspace/project/uwsgi.sock.

The two socket names are different. The two protocols are different. The
client is unlikely to successfully talk to the server, under those
conditions.

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list