title: How to have Nginx to proxy pass only on "/" location and serve index.html on the rest
body: <p>I have a web app that uses Django for the backend and some frontend and ReactJS for stricly the frontend. I am setting up my Nginx configuration and I am trying to get Nginx to proxy_pass only on the "/" location and then on the rest of the locations I want it to serve the index.html file from React.</p>
  
  <p>Here is my current Nginx configuration under sites-available. So the only url that does not have the prefix "/home/" or "/app/" is the homepage. I want Django to serve the homepage and then ReactJS to serve the rest.</p>
  
  <pre><code>server {
  listen 80;
  root /home/route/to/my/ReactJS/build;
  server_name www.mydomain.com;
  
  location = /favicon.ico { log_not_found off; }
  
  location / {
      include proxy_params;
      proxy_pass http://0.0.0.0:8000;
  }
  
  location /home/ {
      try_files $uri $uri/ /index.html;
  }
  
  location /app/ {
      try_files $uri $uri/ /index.html;
  }
  }
  </code></pre>
  
  <p>Let me know if you need any more details or if I could clear things up.</p>
  
  <p>Thanks!</p>