title: static files with gunicorn, django and nginx
body: <p>I have a django project and want to deploy it using gunicorn and nginx.</p>
  
  <p>So far everything works, but when I add subdomains, static files are not served and my page look terrible!</p>
  
  <p>If I use localhosts instead, everything works perfect!</p>
  
  <p>Here I leave my nginx.conf:</p>
  
  <pre><code>server {
      listen 80 default;
      client_max_body_size 4G; 
      server_name mytest.dev;
  
      keepalive_timeout 5;
  
      # path for static files
      root /Users/danielrodriguez/workspace/mtt/static;
  
      location / { 
          # checks for static file, if not found proxy to app 
          try_files $uri @proxy_to_app;
      }   
  
      location @proxy_to_app {
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Host $http_host;
          proxy_redirect off;
  
          proxy_pass   http://localhost:8000;
      }   
  }
  </code></pre>
  
  <p>I also have this in my hosts file:</p>
  
  <pre><code>127.0.0.1   localhost
  127.0.0.1   mytest.dev
  255.255.255.255 broadcasthost
  ::1             localhost 
  fe80::1%lo0 localhost
  </code></pre>
  
  <p>How can I make nginx to work as it does when I type "localhost" in my browser when I type "mydev.test"? Pretty much all I want to do is serve a bunch of sites within the same physical server using something like virtualhosts in apache.</p>
  
  <p>PD: I'm also using OS Lion in case it helps.</p>