First time here? Check out the FAQ!
2

Why do I need a socket for uwsgi?

I can start Askbot by

python manage.py runserver `hostname -i`:8000

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

[uwsgi]
static-map = /m=/app/static
env = DJANGO_SETTINGS_MODULE=settings
env = NO_DEBUG=T
wsgi-file = /app/django.wsgi
http = 0.0.0.0:80
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.

Question

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.
Jasmine Lognnes's avatar
21
Jasmine Lognnes
asked 2016-06-22 09:48:53 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

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

[uwsgi]
socket = /var/uwsgi/ask_node1.sock
user = www-data
chdir = /srv/ask/node1
logto = /var/log/uwsgi/ask_node1.err
pidfile =  /var/uwsgi/ask_node1.pid
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.

Evgeny's avatar
13.2k
Evgeny
answered 2016-06-30 05:14:13 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments