title: Nginx location, alias, rewrite, root
body: <p>I'm serving /foo/bar/ by way of proxypass and want to continue doing so.  However, I would like to serve /foo/bar/baz.swf statically from say /var/www/mystatic/baz.swf and so forth.</p>
  
  <p>I was hoping that I could do something like</p>
  
  <pre><code>    location /foo/bar/(.*) {
        alias /var/www/mystatic/;
      }
  
      location / {
        proxy_pass ....;
        ... 
      }
  </code></pre>
  
  <p>And /foo/bar/ would go to the application server while /foo/bar/(.*) would be served statically.</p>
  
  <p>the docs say that I can't do this and need to use a combination of root and rewrite: <a href="http://wiki.nginx.org/NginxHttpCoreModule" rel="nofollow noreferrer">http://wiki.nginx.org/NginxHttpCoreModule</a></p>
  
  <p>Adding to the complication, I would like to continue using the ancient, unsupported 0.5.33.  Any help would b greatly appreciated.</p>
  
  <p>Edit: moving forward, someone suggested using root instead of alias.  But, it doesn't seem that I can use any regex on the location directive  with my version?  Here, /foo/bar/baz.swf is served by the proxy_pass!  I have the file at /var/www/foo/bar/baz.swf.</p>
  
  <pre><code>    location /foo/bar/(.+) {
        root /var/www/;
      }
  </code></pre>