title: Nginx - Primary script unknown while reading response header from upstream
body: <p>Recently we have migrated from <code>Apache2</code> to <code>Nginx</code> server. Consider we have domain <code>www.test.com</code> and following is the <code>www.test.com.conf</code> and I had disabled <code>default</code> Nginx default file.</p>
  
  <pre><code>server {
      server_name www.test.com;
  
      # Character Set
      charset utf-8;
  
      # Logs
      access_log /var/log/nginx/access.log;
      error_log /var/log/nginx/error.log;
  
      # Directory Indexes
      index index.html index.htm index.php;
  
      # Document Root
      root /var/www/html/project1/public;
  
      # Location
      location / {
          try_files $uri $uri/ /index.php$is_args$args;
      }
  
      # Error Pages
      error_page 404 /404.html;
      error_page 500 502 503 504 /50x.html;
  
      # PHP-FPM Support
      location ~ \.php$ {
          fastcgi_read_timeout 240;
          fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; #/var/run/php5-fpm.sock;
          #include fastcgi.conf;
          fastcgi_index index.php;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          include fastcgi_params;
      }
  
      # Block access to .htaccess
      location ~ \.htaccess {
          deny all;
      }
      client_body_timeout 10s;
      client_header_timeout 10s;
      client_max_body_size 100M;
  
      listen 443 ssl; # managed by Certbot
      ssl_certificate /etc/letsencrypt/live/www.test.com/fullchain.pem; # managed by Certbot
      ssl_certificate_key /etc/letsencrypt/live/www.test.com/privkey.pem; # managed by Certbot
      include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
      ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
  }
  server {
      if ($host = www.test.com) {
          return 301 https://$host$request_uri;
      } # managed by Certbot
  
  
      listen *:80;
      server_name www.test.com;
      return 404; # managed by Certbot
  
  }
  </code></pre>
  
  <p>With the above configuration, I can access <code>https://www.test.com</code> without issues. In this case root <code>/var/www/html/project1/public</code>. Now to access multiple applications from the same domain I had changed the root directive to <code>/var/www/html/</code> and tried to access <code>https://www.test.com/project1/public</code> but I'm getting the following error</p>
  
  <p><code>FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream</code></p>
  
  <p>May I know the reason for this issue? my application is <code>Lumen</code> which is a mirco service framework by <code>Laravel</code>.</p>