Ask Your Question

Why do I need a socket for uwsgi?

asked 2016-06-22 09:48:53 -0600

Jasmine Lognnes gravatar image

I can start Askbot by

python runserver `hostname -i`:8000

and would now like to start it with uwsgi instead. So I have created uwsgi.ini containing

static-map = /m=/app/static
env = NO_DEBUG=T
wsgi-file = /app/django.wsgi
http =
master = true

Below can the output be seen when I start it.

From my understanding I need a socket, if I e.g. would like to use nginx as a reverse proxy on top of uwsgi, but that is not the case here.


Why do I need a socket?

And since it requires a socket, how do I know what it should be?

# /usr/sbin/uwsgi /app/uwsgi.ini 
[uWSGI] getting INI configuration from /app/uwsgi.ini
[uwsgi-static] added mapping for /m => /app/static
*** Starting uWSGI 2.0.12 (64bit) on [Wed Jun 22 14:09:21 2016] ***
compiled with version: 5.3.1 20151207 (Red Hat 5.3.1-2) on 07 January 2016 22:31:51
os: Linux-3.10.0-327.18.2.el7.x86_64 #1 SMP Thu May 12 11:03:55 UTC 2016
nodename: ac5f8aa80b48
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 8
current working directory: /app
detected binary path: /usr/sbin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
your processes number limit is 1048576
your memory page size is 4096 bytes
detected max file descriptor number: 1048576
building mime-types dictionary from file /etc/mime.types...1142 entry found
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
The -s/--socket option is missing and stdin is not a socket.
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-06-30 05:14:13 -0600

Evgeny gravatar image

Sorry, I can't give an in-depth answer on uwsgi, but the following configuration works for me:

socket = /var/uwsgi/ask_node1.sock
user = www-data
chdir = /srv/ask/node1
logto = /var/log/uwsgi/ask_node1.err
pidfile =  /var/uwsgi/
pythonpath = /srv/ask
pythonpath = /srv/ask/node1
virtualenv = /srv/ask/node1/env
env = DJANGO_SETTINGS_MODULE=node1.settings
module = django.core.handlers.wsgi:WSGIHandler() #may need to be adjusted depending on the Django version
env = LC_ALL=en_US.UTF-8
threads = 1
workers = 4 #can be adjusted
master = true
max-requests = 1000
harakiri = 120
buffer-size = 24576

Then in the nginx config specify the socket location for the uwsgi_pass parameter.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-06-22 09:48:53 -0600

Seen: 466 times

Last updated: Jun 30 '16