title: NGINX - No input file specified
body: <blockquote>
    <p>Just want to let everyone know before I posted this question I checked
    every single thread on stackoverflow about this issue.</p>
  </blockquote>
  
  <p><strong>The aim:</strong></p>
  
  <p>Run two apps under one domain, first app on the root (/) and second app under the URI (/learn).</p>
  
  <pre><code>http://example.com/ - first app
  http://example.com/learn - second app
  </code></pre>
  
  <p><strong>The problem:</strong></p>
  
  <p>The main app works perfectly, but the learn app is showing a white page with "No input file specified.".</p>
  
  <p><strong>My file structure:</strong></p>
  
  <pre><code>/srv/users/serverpilot/apps/main/public/index.php
  /srv/users/serverpilot/apps/learn/public/index.php
  </code></pre>
  
  <p><strong>My NGINX configuration:</strong></p>
  
  <pre><code>root "/srv/users/serverpilot/apps/main/public";
  
  location ^~ /learn {
      root    "/srv/users/serverpilot/apps";
      try_files   $uri /learn/public/index.php?$query_string;
      location ~ \.php$ {
          add_header X-debug-message $document_root$fastcgi_script_name always;
          include       fastcgi_params;
          fastcgi_index index.php;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          fastcgi_pass  unix:/srv/users/serverpilot/run/learn.php-fpm.sock;
      }
  }
  
  location / {
      try_files     $uri $uri/ /index.php?$args;
      location ~ \.php$ {
          include       fastcgi_params;
          fastcgi_index index.php;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          fastcgi_pass  unix:/srv/users/serverpilot/run/main.php-fpm.sock;
          try_files     $uri =404;
      }
   }
  </code></pre>
  
  <blockquote>
    <p><strong>In addition:</strong></p>
    
    <ol>
    <li>I know the fastcgi_pass sockets are working because I've been
    running these two apps under different domains but in the same
    server in question.</li>
    <li>I added the <strong>add_header X-debug-message $document_root$fastcgi_script_name" always;</strong> to see what the response header would show, and it shows that the
    SCRIPT_FILENAME is 
    /srv/users/serverpilot/apps/learn/public/index.php which exists and is the exact file I am trying to run.</li>
    </ol>
  </blockquote>