title: Nginx Frontend And Backend under url
body: <p>I have this nginx configuration:</p>
  
  <pre><code>server{
      listen      80;
      server_name     hans.site.dev;
  
      location / {
          index       index.html index.php;
          root    /var/www/a/public;
      }
  
      location /api {
          root /var/www/b/public;
          index  index.php index.html index.htm;
          try_files $uri /api/$uri/ /index.php?$query_string;
  
          location ~ \.php$ {
              fastcgi_pass    unix:/var/run/php/php7.1-fpm.sock;
              fastcgi_index   index.php;
              fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
              include     fastcgi_params;
  
              fastcgi_split_path_info       ^(.+\.php)(/.+)$;
              fastcgi_param PATH_INFO       $fastcgi_path_info;
              fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
              fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          }
      }
  }
  </code></pre>
  
  <p>where:</p>
  
  <ul>
  <li>A : frontend (angular)</li>
  <li>B : backend (lumen)</li>
  </ul>
  
  <p>and later i want to add</p>
  
  <ul>
  <li>C : administrator (angular)</li>
  <li>D : support (angular)</li>
  </ul>
  
  <p>but even for this configuration, when i try to access <strong>hans.site.dev/api/</strong>, it will give me this error:
  "/var/www/<strong><em>a</em></strong>/public/index.php" failed (2: No such file or directory), client: 192.168.56.1, server: hans.site.dev, request: "GET /api/ HTTP/1.1", host: "hans.site.dev".</p>
  
  <p>why it refer to <strong><em>a</em></strong> instead of <strong><em>b</em></strong>? and how to fix it?</p>