title: Nginx match location for root path and all other paths separately
body: <p>I am running Play framework server behind nginx server. At the root path, I am serving static website and all other paths should be redirected to the Play server. I have the following <code>default.conf</code> file in <code>/etc/nginx/conf.d</code> (The system is RHEL 6.7)</p>
  
  <pre><code># to match the root path only to serve static website
  location = / {
          root   /usr/share/nginx/html;
          index  index.html index.htm;
          # try_files $uri $uri.html $uri/ /index.html;
  }
  
  # to match the cms login page
  location /cms/ {
          proxy_pass http://localhost:9000/;
  }
  
  # to match all the requests from the cms
  location / {
          proxy_pass http://localhost:9000/;
  }
  </code></pre>
  
  <p>However, this configuration doesn't match the root path request. It gives 404 error. However, if I remove the third location rule, then it serves the static page at the root path. </p>
  
  <p>Also, I noticed that first time I tried this, it worked. But now, it's not working any more. Please help.</p>