uwsgi socket permissions

uwsgi

Solution

`/run` is a `tmpfs` which means it is not persistent across reboots. Create a directory `/var/uwsgi` instead which will be persistent.

Problem

I'm running into some permission issues with uwsgi running on Ubuntu 12. Here is my ini file: ``` [uwsgi] project = djangorpoject base_dir = /home/mysite/mysite.com uid = www-data gid = www-data plugins = http,python processes = 4 harakiri = 60 reload-mercy = 8 cpu-affinity = 1 max-requests = 2000 limit-as = 512 reload-on-as = 256 reload-on-rss = 192 no-orphans = True #vacuum = True master = True logto = /var/log/uwsgi/%n.log #daemonize = /var/log/uwsgi/%n.log #catch-exceptions disable-logging virtualenv = %(base_dir)/venv chdir = %(base_dir) module = %(project).wsgi:application socket = /run/uwsgi/%n.sock chmod-socket = 666 chown-socket = www-data:www-data ``` As you can see, I am running chmod and chown on the socket file. When I attempt to load my site, I am getting the following error: ``` bind(): Permission denied [socket.c line 107] ``` This goes away if I run ``` sudo chown -R www-data:www-data /run/uwsgi ``` But this doesn't persist when I reboot my server. I am assuming this is because uwsgi is recreating the folder on boot? Is there any way to permanently apply the permissions to socket?

Original source