title: Rewriting nginx for pushState-URL's
body: <p>I am trying to get <code>nginx</code> to work with my <code>pushState</code>-based URI handling that <code>backbone.js</code> manages for me in an Javascript app. </p>
  
  <p>Right now accessing URI's with one level, eg. <code>example.com/users</code> works well, but not two-level or deeper URI's, such as <code>example.com/users/all</code>, which is mentioned in the <a href="http://documentcloud.github.com/backbone/#Router-navigate">Backbone documentation</a>: </p>
  
  <blockquote>
    <p><em>For example, if you have a route of /documents/100, your web server
    must be able to serve that page, if the browser visits that URL
    directly</em></p>
  </blockquote>
  
  <p>So, being far from acquainted with nginx's rewrite options, I am still sure that I can do something like <code>rewrite ^ /index.html;</code> to redirect everything to my <code>index.html</code>, but loosing out on any eventual static files (images, javascript &amp; css) stored on the same server which I need to be able to access.</p>
  
  <p>So what should I do instead with the below shown, current configuration, to make this work? </p>
  
  <pre><code>server {
      listen   80;
      server_name  example.com;
  
      location / {
          root   /var/www/example.com;
          try_files $uri /index.html;
      }
  
  }
  </code></pre>