Install multiple laravel projects in subfolders without subdomain
<p>I already tried to search for this issue, but it's all different from mine, so I'm posting this here. I'm trying to create a webserver using <code>nginx</code> to host multiple laravel projects in subfolders. It's my <strong>labs</strong> server. So I'd like to have my projects like this:</p>

<ul>
<li>domain.com/project1</li>
<li>domain.com/project2</li>
<li>domain.com/project3</li>
</ul>

<p>I'm copying the following nginx <code>location</code> block for each project (i don't know what's happening here, I just copied from the internet and it worked):</p>

<pre><code>location ^~ /project1/ {
        alias /home/web/project1/public;
        try_files $uri $uri/ @project1;

    location ~ \.php {
        fastcgi_pass                    unix:/var/run/php5-fpm.sock;
        fastcgi_index                   index.php;
        include                         /etc/nginx/fastcgi_params;
        fastcgi_param                   SCRIPT_FILENAME "/home/web/project1/public/index.php";
    }

}

location @project1 {
     rewrite /avm/(.*)$ /project1/index.php?/$1 last;
}
</code></pre>

<p>And RESTful routes in my laravel app like this:
    

<pre><code>/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', ['middleware' =&gt; 'auth','uses' =&gt; 'HomeController@index'])-&gt;name('home');

// Authentication
Route::get('auth/login', 'Auth\AuthController@getLogin');
Route::post('auth/login', 'Auth\AuthController@authenticate');
Route::get('auth/logout', 'Auth\AuthController@getLogout');

// Administração
Route::group(['prefix' =&gt; 'administracao', 'middleware' =&gt; 'auth'], function() {
    Route::resource('filiais', 'FiliaisController');
    Route::resource('precos', 'PrecosController');
    Route::resource('funcionarios', 'FuncionariosController');
    Route::resource('cargos', 'CargosController');
    Route::resource('vendedores', 'VendedoresController');
});

// Comercial
Route::group(['prefix' =&gt; 'comercial', 'middleware' =&gt; 'auth'], function() {
    Route::resource('clientes', 'ClientesController');
    Route::resource('fichas', 'FichasController');
});

// Operacional
Route::group(['prefix' =&gt; 'operacional', 'middleware' =&gt; 'auth'], function() {
    Route::resource('agenda', 'AgendaController');
    Route::resource('os', 'OsController');
    Route::resource('ambientes', 'AmbientesController');
    Route::resource('processos', 'ProcessosController');
    Route::get('relatorios', 'RelatoriosController@index');

    Route::group(['prefix' =&gt; 'processo', 'middleware' =&gt; 'auth'], function() {
        Route::get('create', 'ProcessoController@create');
        Route::get('index', 'ProcessoController@index');

        Route::post('{os}/parse', 'ProcessoController@parse');

        Route::get('{os}', 'ProcessoController@principal');
        Route::match(['get', 'post'], '{os}/detalhe', 'ProcessoController@detalhe');
        Route::get('{os}/duplicidades', 'ProcessoController@duplicidades');
        Route::get('{os}/restantes', 'ProcessoController@restantes');
        Route::match(['get', 'post'], '{os}/auditoria', 'ProcessoController@auditoria');
        Route::match(['get', 'post'], '{os}/operadores', 'ProcessoController@operadores');
        Route::match(['get', 'post'], '{os}/divergencia', 'ProcessoController@divergencia');
        Route::match(['get', 'post'], '{os}/finalizar', 'ProcessoController@finalizar');
        Route::get('{os}/excluir/{setor}', 'ProcessoController@destroy');
    });
});
</code></pre>

<p>Although it seems to work (the page appears, etc) when it goes into bussiness logic (save to database, etc.) it appears to have many bugs. For example when I try to create a new employee in url <code>http://domain.com/project1/administracao/funcionarios</code> it gives me the error: <code>SQLSTATE[42S22]: Column not found: 1054 Unknown column '/administracao/funcionarios' in</code> (it's kinda prepending some url routes)</p>

<p>And when I setup a subdomain like <code>project1.domain.com</code> everything works fine. But I don't want to create a subdomain for each project, I want it to work in subfolders url. Is it possible?</p>