title: Nginx ignores root directive (different from global) in a location block
body: <p>I am trying to add html form and javascript file which send post request. I placed it in dicrectory different from my front end (written in angular).</p>
  
  <p>Here is the nginx confg.</p>
  
  <pre><code>server {
  listen 80;
  real_ip_header X-Forwarded-For;
  set_real_ip_from 127.0.0.1;
  server_name localhost;
  
  root /var/www/html/psycho-test-rest/psycho_front/dist;
  
  location /download_report/ {
  root /var/www/html/psycho-test-rest/psycho_front/user-results;
  try_files $uri /resultsdownload.html;
  }
  
  location ~ ^/(tests|CRUD)/ {
  include uwsgi_params;
  uwsgi_pass unix:/var/www/html/psycho-test-rest/socket.sock;
  uwsgi_modifier1 30;
  }
  
  error_page 404 =200 /index.html;
  location = /404.html {
  root /usr/share/nginx/html;
  }
  
  error_page 500 502 503 504 /50x.html;
  location = /50x.html {
  root /usr/share/nginx/html;
  }
  }
  </code></pre>
  
  <p>I am trying to make nginx return <code>resultsdownload.html</code> in the first directive, but file is always not found as root directory in location block is always replaced by global root. Here is the error from error.log.</p>
  
  <pre><code>2018/06/19 05:21:59 [error] 26553#26553: *6 open() "/var/www/html/psycho-test-rest/psycho_front/dist/user-results/resultsdownload.html" failed (2: No such file or directory), client: 212.XXX.XXX.XXX, server: localhost, request: "GET /user-results/resultsdownload.html HTTP/1.1", host: "188.XXX.XXX.XXX"
  </code></pre>