title: django with gunicron and nginx
body: <p>I have developed django application and now deploying this on freebsd server using gunicron and nginx.  I have added guncorn in projects settings files under installedapps. and placed gunicorn.conf.py in root as:</p>
  
  <pre><code>import os
  
  def numCPUs():
      if not hasattr(os, "sysconf"):
          raise RuntimeError("No sysconf detected.")
      return os.sysconf("SC_NPROCESSORS_ONLN")
  
  user = root
  workers = numCPUs() * 2 + 1
  bind = "127.0.0.1:8000"
  pidfile = "/tmp/gunicorn-srv.pid"
  backlog = 2048
  logfile = "/data/logs/gunicorn_srv.log"
  loglevel = "info"
  </code></pre>
  
  <p>Then in nginx.conf updated server tag with:</p>
  
  <pre><code>    listen       80;
      server_name localhost;
  
      access_log   /var/log/nginx/nginx-access.log;
      #charset koi8-r;
  
      #access_log  logs/host.access.log  main;
  
      location / {
          proxy_pass   http://127.0.0.1:8000;
          #root   /usr/local/www/nginx;
          #index  index.html index.htm;
      }
  
      location  /media/ {
          root /data/webs/uni_rate;
      }
      location  /static/ {
          root /data/webs/uni_rate;
      }
  </code></pre>
  
  <p>Now I have started nginx and guncorn. If I brows my public ip page is shown but static files are not served. If I directly hit </p>
  
  <pre><code>http://myip/static/folder/file.css
  </code></pre>
  
  <p>then 403 error is returned. Any Idea what could be the reason or what else information should be provided to diagnose it.</p>
  
  <p>My media and static directories are respectively:</p>
  
  <pre><code>/data/webs/uni_rate/media
  /data/webs/uni_rate/static
  </code></pre>
  
  <p>here is an output of nginx-access.log</p>
  
  <pre><code>182.178.6.248 - - [01/Apr/2013:11:14:54 -0500] "GET /static/bootstrap_toolkit_extras/css/bootstrap.css HTTP/1.1" 403 168 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv
  :16.0) Gecko/20100101 Firefox/16.0"
  182.178.6.248 - - [01/Apr/2013:11:15:00 -0500] "-" 400 0 "-" "-"
  </code></pre>