title: uwsgi socket permissions
body: <p>I'm running into some permission issues with uwsgi running on Ubuntu 12. Here is my ini file:</p>
  
  <pre><code>[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
  </code></pre>
  
  <p>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:</p>
  
  <pre><code>bind(): Permission denied [socket.c line 107]
  </code></pre>
  
  <p>This goes away if I run </p>
  
  <pre><code>sudo chown -R www-data:www-data /run/uwsgi
  </code></pre>
  
  <p>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?</p>