title: Nginx block server routing
body: <p>I am trying to route a url to another part of my server - the admin area which is made by angular using nginx server blocks.</p>
  
  <p>I can get it working using</p>
  
  <pre><code>location ~ /admin {
       root /home/sysadmin/html;
  }
  </code></pre>
  
  <p>This routes to <strong>/home/sysadmin/html/admin.index.html</strong>. What I can't figure out is how to route all deeper URLS to this file location i.e. <code>/admin/dashboard/</code> would also go to <code>/home/sysadmin/html/index.html</code>. </p>
  
  <p>For example, if go to <code>www.url.com/admin/</code> it works and my angular app runs but if I refresh on <code>www.url.com/admin/login</code> it will produce a 404.</p>
  
  <p>I need all child urls of <code>/admin</code> to go to my systems <code>/home/sysadmin/html/admin/index.html</code> file.</p>
  
  <p>Please note, this is a nginx issue not a angular one as I can navigate and run my project fine.</p>
  
  <p>is it best to setup an alternative subdomain that points to <code>www.url.com/admin</code> and manage it another server block?</p>
  
  <p>Hope this is clear. </p>