title: Can't get two single page applications to run together on one server using nginx
body: <p><strong><em>UPDATE:</strong> I have edited this post to provide a clearer understanding of the issue. The previous post has been overwritten by this update.</em></p>
  
  <p>We have two single page applications that need to be accessible through the same domain and ports but at different locations.</p>
  
  <p><strong>Application1</strong> is a public user facing application that should be loaded when visiting <a href="https://example.com" rel="nofollow noreferrer">https://example.com</a>.</p>
  
  <p><strong>Application2</strong> is a public admin facing application that will require authentication and should be loaded instead of application1 if they visit <a href="https://example.com/admin" rel="nofollow noreferrer">https://example.com/admin</a>.</p>
  
  <p>Currently I have no problem loading the first application, however, I have tried all sorts of combinations with my nginx conf file to get the second application to load when visiting <a href="https://example.com/admin" rel="nofollow noreferrer">https://example.com/admin</a> without success.</p>
  
  <p>It is always loading the application1 app instead.</p>
  
  <pre><code>Application1 = /var/www/client/public
  Application2 = /var/www/client/admin
  
  /var/www/client
       /public (application1)
            index.html
            /dist
       /admin (application2)
            index.html
            /dist
  </code></pre>
  
  <p>This is the example.com.conf file. I have tried all sorts of combinations but this is me trying to keep it very simple. </p>
  
  <pre><code>server {
       listen 80;
  
       root /var/www/client;
       index index.html index.htm;
  
       server_name happyhourmenu.ca;
  
       location / {
            root /var/www/client/public;
            try_files $uri $uri/ =404;
       }
  
       location /admin {
            alias /var/www/client/admin;
            try_files $uri $uri/ =404;
       }
  }
  </code></pre>
  
  <p>I have spent days on this, can't believe something that should be so simple has been holding me up this long.</p>