E
E
EVOSandru62020-12-09 23:01:36
Nginx
EVOSandru6, 2020-12-09 23:01:36

Why does Laravel get 404 not found on the root route from under Docker?

Good afternoon.

Why, with a similar configuration on local in docker, a site on laravel 8 correctly processes routes, but on a VPS :

404 not found

cant somewhere inside /public/index.php

$response = tap($kernel->handle(
    $request = Request::capture()
))->send();


Since the Exception thrown before this block exits.

Cleaned all caches, including route caches.

Already left a single route:

Route::get('/', function () {
    return view('welcome');
});


And it doesn't show up.

The list of routes is printed correctly via:

sudo docker-compose exec php-cli php artisan route:list;


Fragment from nginx conf thrown into the container:

server {
    listen 443 ssl;
    server_name www.domen.ru domen.ru;
    charset utf-8;
    index index.php;
    root /var/www/public;

    client_max_body_size 30M;

    location / {
        try_files $uri /index.php?$args;
    }


What could be the reason?

404 is Laravel's.

Addition:

Pulled from the docker. Problem still exists.

Just in case, here are some important snippets:

class RouteServiceProvider extends ServiceProvider {
...

     protected $namespace = 'App\\Http\\Controllers';

...
}


and

composer:

"autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
EVOSandru6, 2020-12-25
@EVOSandru6

If you're interested:
./app/app/Http/Kernel.php Commented
out this thing, now it's ok:
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question