19

I'm trying to create a unix socket application for a run in uWSGI... but does not allow me to create the socket, please check the following settings.

[uwsgi]
chdir           = /home/deploy/webapps/domain/virtualenv/app
module          = app.wsgi
home            = /home/deploy/webapps/domain/virtualenv
master          = true
processes       = 10
uwsgi-socket    = /var/run/uwsgi/app/%n/socket # if i'm tried /tmp/name.socket if work!
vacuum          = true

# Error codes:
The -s/--socket option is missing and stdin is not a socket.
bind(): No such file or directory [core/socket.c line 230]

I have given permissions to this directory and is created but does not work.

mkdir -p /var/run/uwsgi/app
sudo chown -R deploy:root /var/run/uwsgi/app
sudo chmod 777 /var/run/uwsgi/app

which would be the same solution for this. thanks.

Colpaisa
  • 355
  • 1
  • 4
  • 14
  • 1
    the directory is /var/run/uwsgi/app/%n not /var/run/uwsgi/app, %n is the name of the config file, so ensure this directory exists. – roberto Jan 06 '15 at 08:44

2 Answers2

7

You need to do two things:

mkdir /var/run/app-uwsgi

and

sudo chown -R www-data:www-data /var/run/app-uwsgi

After a reboot this directory gets lost and needs to be recreated in Ubuntu.

Josh Correia
  • 3,807
  • 3
  • 33
  • 50
Houman
  • 64,245
  • 87
  • 278
  • 460
  • 1
    This IS because of an incorrect directory, but the question here isn't running as www-data (based on the provided config), and has a different path that they are trying to put the socket in. – Paul Becotte Jun 23 '16 at 19:22
  • 1
    The first suggestion makes no sense and look to be a typing error. Can you clarify? – Bernd Wechner Oct 19 '20 at 10:25
6

I had the same error trying to run uwsgi inside a Docker container, so I needed to create the directories first.

I needed to add the following command to the end of my Dockerfile:

RUN mkdir -p /var/www/todobackend

The settings of the server in my case are part of the docker-compose.yml file:

      - uwsgi
      - "--socket /var/www/todobackend/todobackend.sock"
      - "--chmod-socket=666"
      - "--module todobackend.wsgi"
      - "--master"
      - "--die-on-term"
Ru Chern Chong
  • 3,692
  • 13
  • 33
  • 43
eyesfree
  • 126
  • 2
  • 5