title: nginx config with spa and subdirectory root
body: <p>I always seem to have problems with nginx configurations. My SPA is located at /mnt/q/app (pushstate is enabled) and the frontend root is located at client/public. Everything should be mapped to index.html, where the app picks up the route and decides what to do. </p>
  
  <p>Full path to the index is <code>/mnt/q/app/client/public/index.html</code>.</p>
  
  <p>I think I ran out of options by now. No matter what I do, I just get a 404 back from nginx, I think the configuration is simple enought and have no clue what's wrong.</p>
  
  <pre><code>server {
      listen 80;
      server_name app.dev;
  
      root /mnt/q/app;
  
      location / {
        root /client/public;
        try_files $uri @rewrites =404;
      }
  
      location @rewrites {
         rewrite ^(.+)$ /index.html last;
      }
  }
  </code></pre>
  
  <p>Any help is appreciated.</p>