title: Deploying a laravel app with a node js app in nginx
body: <p>I have a node.js app running using pm2. When I go to my endpoint it works, i see things. But then when I try to do an action that connects to the backend api at laravel, then nothing happens.</p>
  
  <p>This is how I have my nginx config configured:</p>
  
  <pre><code>server {
      listen 80;
      server_name make.tube;
      root /maketube/api/public;
  
      # This is the "last resort" nginx will direct to when no other matches with location have been found.
      # This will proxy pass to another website (should be tested with http://localhost:3000 in your case).
      location / {
          proxy_pass http://localhost:3000;
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "upgrade";
      }
  
      # All requests that start with /api are directed to the laravel location.
      # It will only look for a file named index.html
      location /api {
          index index.html;
      }
  }
  </code></pre>
  
  <p>When I try to perform an action that should connect to the backend (like sign in) then it fails to work try the signin function on make.tube (<a href="http://localhost:3000/api/auth/login/" rel="nofollow noreferrer">http://localhost:3000/api/auth/login/</a>).</p>
  
  <p>Does anyone know how I can get this working so when I perform the sign in it connects to my laravel backend?</p>