title: All Laravel routes gives 404 on nginx subdirectory
body: <p>I have a problem with nginx configuration. I wanna have Laravel app in subdirectory, exactly domain.com/alfa. At domain.com is another app. And now all Laravel routes gives 404 on nginx subdirectory. Could someone help find an error?</p>
  
  <p>My paths:</p>
  
  <ul>
  <li>/var/www/  &lt;-- it's for domain.com</li>
  <li>/var/www/alfa_path  &lt;-- it's for domain.com/alfa</li>
  </ul>
  
  <p>It's my nginx configuration:</p>
  
  <pre><code>server
  {
          listen 80;
          server_name domain.com;
  
          root /var/www;
          index index.php index.html index.htm;
  
          location / {
          }
  
          location /alfa {
                  root /var/www/alfa_path/public;
                  index index.php index.html index.htm;
                  try_files $uri $uri/ /alfa_path/public/index.php?$query_string;
          }
  
          location ~ .php$ {
                  try_files $uri =404;
                  fastcgi_pass unix:/var/run/www.sock;
                  fastcgi_index index.php;
                  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                  include /etc/nginx/fastcgi_params;
          }
  
          location /phpmyadmin {
                  root /usr/share/;
                  index index.php index.html index.htm;
                  location ~ ^/phpmyadmin/(.+\.php)$ {
                          try_files $uri =404;
                          root /usr/share/;
                          fastcgi_pass unix:/var/run/www.sock;
                          fastcgi_index index.php;
                          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                          include /etc/nginx/fastcgi_params;
                  }
                  location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                          root /usr/share/;
                  }
          }
  
          location /phpMyAdmin {
                  rewrite ^/* /phpmyadmin last;
          }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/YYtV0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YYtV0.png" alt="laravel 404"></a></p>