title: nginx tries to find index.html in a directory according to the uri
body: <p>I have this simple configuration for nginx to serve my React app:</p>
  
  <pre><code>server {
      listen 80;
      root /usr/share/nginx/html;
  
      location / {
          try_files $uri $uri/ /index.html;
      }
  }
  </code></pre>
  
  <p>I have routes <code>/</code> and <code>login</code>. Everything works fine when I go from <code>localhost/</code> to <code>localhost/login</code> via React-Router. But when I type <code>localhost/login</code> in the browser, I get the 404 error.</p>
  
  <p>To be exact, for <code>localhost/login</code> I get <code>"/usr/share/nginx/html/login" failed (2: No such file or directory)</code> in nginx console.
  And for <code>localhost/login/</code> I get <code>"/usr/share/nginx/html/login/index.html" is not found (2: No such file or directory)</code></p>
  
  <p>I can't understand why nginx keep looking for <code>index.html</code> in <code>/usr/share/nginx/html/login/</code> instead of <code>/usr/share/nginx/html/</code>. Any ideas what I'm doing wrong?</p>