title: Serving static files from nginx with django + fastcgi debian
body: <p>I'm a little rusty when it comes to the new way of static file serving with django 1.3 however I'm sure it cannot be django that is at fault here. </p>
  
  <p>I'm trying to run a django app with nginx + fastcgi on a cloud server with debian installed. We only have one server at the moment (while we develop) and will be looking to run multiple servers with a load balancer to make this a little simpler however I'm having trouble actually getting nginx to serve static files.</p>
  
  <p>I've followed various tutorials for setting up nginx.conf to serve the files</p>
  
  <pre><code>server {
      listen 80;
      server_name 127.0.0.1;
  
      location /static  {
          autoindex on;
          root /static;
      }
  }
  </code></pre>
  
  <p>The above is an extract from nginx.conf. Now no matter what I set root to, nginx throws a 404 not found error when trying to access <code>http://127.0.0.1/static/</code>.</p>
  
  <p>The file structure is as follows:</p>
  
  <pre><code>/home/user/site/project
  /home/user/site/static
  /home/user/site/templates
  </code></pre>
  
  <p>Django settings.py has the following set up as STATIC_ROOT and STATIC_URL</p>
  
  <pre><code>STATIC_ROOT = "/home/user/site/static/"
  STATIC_URL  = "http://127.0.0.1/static/"
  </code></pre>
  
  <p>If anyone could point us in the right direction of where to do with this it would be fantastic.</p>