Empty basePath in nginx


I don’t know if i’m doing something wrong (sure i’m doing something wrong).
In my development server I have nginx with standard configuration. This works pointing to my /var/projects/ folder and i can load projects directly from subfolder:


But recently i have new project with views and i was added special config to nginx to do slim 3 work correctly in subfolder:

location /project2 {
    try_files $uri $uri/ /project2/index.php$is_args$args;

My first one problem I found is routes, i need to add group with root subfolder because Slim 3 don’t found routes without them:

$app->group('/project2', function(){ //without this line routes isn't found
    $this->map(['GET', 'POST', 'PUT'], '/events[/{id}]', App\Actions\EventsAction::class)->setName('events');

Second problem is Slim\Http\Uri object have basePath empty. I like to use basePath for generate urls in Views.

Anyone with similar behavior?