title: How to match a single file in nginx if there is a root location
body: <p>I have a nginx config for single-page application with proxying app (it's json api) and static files (they're only loaded).</p>
  
  <pre><code>upstream my_app {
          server 127.0.0.1:3001;
  }
  
  server {
      listen 80;
  
      location ~ ^/(api|admin|attachments|sitemap.xml)/ {
          proxy_pass http://my_app;
      }
  
      location / {
          alias /var/www/my_app/dist/;
          che, must-revalidate, post-check=0, pre-check=0";
          try_files $uri$args $uri$args/ $uri/ /index.html =404;
      }
  }
  </code></pre>
  
  <p>It successfully proxies queries for <code>api</code>, <code>admin</code>, <code>attachments</code> to <code>my_app</code>, but this doesn't happen with <code>sitemap.xml</code>. Nginx is trying to get <code>sitemap.xml</code> from <code>/var/www/my_app/dist</code>. </p>
  
  <p>Why? How can I fix that?</p>