1

I try to create a socket for communication between uwsgi and nginx.

The difficulty is that I don't know what major and minor numbers I should specify:

v:/tmp# mknod wsgi_pgame.sock c
mknod: missing operand after `c'
Special files require major and minor device numbers.

And I don't know whether the device should be block or character.

Could you please help?

7

Mknod (mknod p, not c) creates a fifo, a unix socket. Unix sockets are different beasts and don't nead mknod (or root privileges for that matter). Configured properly, uwsgi will create the socket for you, you just need to make sure the permissions are right so nginx can use it. Something like this for a Debian-ish system.

shared-socket = 1
socket        = /tmp/uwsgi.sock
chmod_socket  = 600
chown_socket  = www-data
uid           = www-data
gid           = www-data
  • FIFO (AKA "pipe", shown as p in ls output) is not the same thing as UNIX socket (shown as = in ls output). Unfortunately, you can't create UNIX socket with mknod. This is mostly for historical reasons: i.e. normally, bind() call expects the node to not exist, so creation of UNIX socket node beforehand, prior to actual connection process, make little sense. That said, if you really want to create it, most modern netcat / nc variants can do that. – GreyCat May 28 '18 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.