title: Serve Django and Angular with same nginx config
body: <p>I am trying to setup Django and Angular app with Uwsgi and nginx</p>
  
  <p>My config :</p>
  
  <pre><code>upstream django {
      server unix:///home/deepankar/stuff/proj/server/project/mysite.sock; # for a file socket
  }
  
  # configuration of the server
  server {
      # the port your site will be served on
      listen      80; 
      # the domain name it will serve for
      server_name _; # substitute your machine's IP address or FQDN
      charset     utf-8;
  
      # max upload size
      client_max_body_size 75M;   # adjust to taste
  
      # Django media
      location /media  {
          alias /path/to/your/mysite/media;  # your Django project's media files - amend as required                                             
      }   
  
  
      location / { 
          root /home/deepankar/stuff/proj/client/build; # your Django project's static files - amend as required
          try_files $uri $uri/ /index.html;
      }   
  
      # Finally, send all non-media requests to the Django server.
      location /api {
          uwsgi_pass  django;
          include     /etc/nginx/uwsgi_params; # the uwsgi_params file you installed
      } 
  </code></pre>
  
  <p>How do I make sure that all /api gets routed to the uwsgi django server and <code>/</code> should get routed to the angular application which is compiled under the <code>build</code> folder.</p>
  
  <p>Right now Everything gets routed to the angular app</p>