前提
あるシステムを作成中なのですが、2週間くらい前からか http://〇〇〇/admin/ にアクセスすると404エラーになる
実現したいこと
404エラー画面でなく、正常な画面を表示させたい
発生している問題・エラーメッセージ
error.logは 2022/05/25 13:47:46 [error] 33#33: *38 FastCGI sent in stderr: "PHP message: Xdebug: [Log Files] File '/var/log/xdebug.log' could not be opened.PHP message: Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: host.docker.internal:9003 (through xdebug.client_host/xdebug.client_port) :-(" while reading response header from upstream, client: 172.18.0.1, server: _, request: "GET /admin/ HTTP/1.1", upstream: "fastcgi://172.18.0.3:9000", host: "localhost"
access.logは 172.18.0.1 - - [25/May/2022:13:47:46 +0000] "GET /admin/ HTTP/1.1" 404 1564 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0"
laravel.logは [2022-05-25 12:03:07] laravel.ERROR: Class 'Form' not found (View: /var/www/html/resources/views/admin/users/index.blade.php) {"exception":"[object] (Facade\\Ignition\\Exceptions\\ViewException(code: 0): Class 'Form' not found (View: /var/www/html/resources/views/admin/users/index.blade.php) at /var/www/html/resources/views/admin/users/index.blade.php:33, Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Class 'Form' not found at /var/www/html/storage/framework/views/a722cbb5716f4d37188b5d222c6bbff40b4653f9.php:33) [stacktrace] #0 /var/www/html/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(43): include() #1 /var/www/html/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(59): Illuminate\\View\\Engines ~ "}
web.phpは
<?php Route::get('/', function () { return view('welcome'); }); Auth::routes(); Route::get('/home', 'HomeController@index')->name('home'); ~ ?>
welcome.blade.php
<!doctype html> <html lang="{{ app()->getLocale() }}"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Laravel</title> <!-- Fonts --> <link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css"> <!-- Styles --> <style> html, body { background-color: #fff; color: #636b6f; font-family: 'Raleway', sans-serif; font-weight: 100; height: 100vh; margin: 0; } .full-height { height: 100vh; } .flex-center { align-items: center; display: flex; justify-content: center; } .position-ref { position: relative; } .top-right { position: absolute; right: 10px; top: 18px; } .content { text-align: center; } .title { font-size: 84px; } .links > a { color: #636b6f; padding: 0 25px; font-size: 12px; font-weight: 600; letter-spacing: .1rem; text-decoration: none; text-transform: uppercase; } .m-b-md { margin-bottom: 30px; } </style> </head> <body> <div class="flex-center position-ref full-height"> @if (Route::has('login')) <div class="top-right links"> @auth <a href="{{ url('/home') }}">Home</a> @else <a href="{{ route('login') }}">Login</a> <a href="{{ route('register') }}">Register</a> @endauth </div> @endif <div class="content"> <div class="title m-b-md"> Laravel </div> <div class="links"> <a href="https://laravel.com/docs">Documentation</a> <a href="https://laracasts.com">Laracasts</a> <a href="https://laravel-news.com">News</a> <a href="https://forge.laravel.com">Forge</a> <a href="https://github.com/laravel/laravel">GitHub</a> </div> </div> </div> </body> </html>
route.phpというのはroutes.phpのことですか?それなら↓です。
<?php use Illuminate\Routing\Router; Admin::routes(); Route::group([ 'prefix' => config('admin.route.prefix'), 'namespace' => config('admin.route.namespace'), 'middleware' => config('admin.route.middleware'), 'as' => config('admin.route.prefix') . '.', ], function (Router $router) { $router->get('/', 'HomeController@index')->name('home'); });
試したこと
①laravel.logは
[2022-05-25 12:03:07] laravel.ERROR: Class 'Form' not found (View: /var/www/html/resources/views/admin/users/index.blade.php) {"exception":"[object] (Facade\Ignition\Exceptions\ViewException(code: 0): Class 'Form' not found となってたので、 composer require laravelcollective/html打ったら、loadingなどしこれはこれで成功。しかし404エラーは直らず。
②error.logは
2022/05/25 13:47:46 [error] 33#33: *38 FastCGI sent in stderr: "PHP message: Xdebug: [Log Files] File '/var/log/xdebug.log' could not be opened.PHP message: Xdebug: [Step Debug] Time-out connecting to debugging client,となっていたので、https://qiita.com/k_kuma/items/a009177ec721fccd037e を参考に launch.json↓ をプロジェクト直下に配置
{ "version": "20.10.11", "configurations": [ { "name": "Listen for XDebug", "type": "php", "request": "launch", "port": "9000", "pathMappings": { "/var/www": "${C:\admin}/www" } } ] }
*どちらも途中でphp artisan migrate:freshを打ってるが、404エラーのまま
補足情報(FW/ツールのバージョンなど)
・自分のパソコン(Windows10)にDocker(20.10.11)をインストール
・Laravel5.8.38(PHP)の開発
・MySQL

回答2件
あなたの回答
tips
プレビュー