title: Angular 9 + Ngnix = 404 when deeplinking
body: <p>I'm creating an <code>Angular 9</code> application with a <code>Loopback 4</code> backend using <code>nginx</code>.</p>
  <p>When using <code>ng serve</code> I can navigate to different pages and refresh the page without issue. However after pushing to the staging server, I can navigate the app but if I refresh any page that isn't <code>staging.mydomain.com/</code> I get a 404 error.</p>
  <p>I've tried adding <code>try_files $uri $uri/ /index.html;</code> to the <code>location</code> section of my <code>nginx.conf</code> file, but when I do that the even the index page doesn't load any more.</p>
  <p>Below you'll see the the <code>server</code> section of my <code>nginx.conf</code> file:</p>
  <pre><code>server {
  
    listen       443 ssl http2;
    listen       [::]:443 ssl http2;
    server_name  staging.mydomain.com; # managed by Certbot
    root         /usr/share/nginx/html;
    ssl_certificate /etc/letsencrypt/live/staging.mydomain.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/staging.mydomain.com/privkey.pem; # managed by Certbot
  
    # Load configuration files for the default server block.
    include /etc/letsencrypt/options-ssl-nginx.conf;
  
    add_header Strict-Transport-Security &quot;max-age=31536000; includeSubDomains&quot; always;
  
    location / {
      #try_files $uri $uri/ /index.html;
      proxy_pass http://127.0.0.1:3004;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Conneciton 'upgrade';
      proxy_set_header Host $host;
      proxy_cache_bypass $http_upgrade;
    }
  
  }
  
  server {
    listen 80;
    server_name staging.mydomain.com;
    return 301 https://staging.mydomain.com$request_uri;
  }
  </code></pre>
  <p>Is anybody able to provide some guidance to get my deep links working correctly?</p>