LoginSignup
28
7

More than 3 years have passed since last update.

dockerを使ったlaravelでの「file not found.」エラー

Last updated at Posted at 2019-11-02

laravelの初期画面が出ず、
file not found.が表示されてしまう時の解決手法のメモです。

スクリーンショット 2019-11-03 0.30.54.png

初期のlaravelのルーティングを確認。これはあってそう。localhostで動きそうだが。。

routes/web.php
Route::get('/', function () {
    return view('welcome');
});

調べていくうちにdockerファイルを作成するときにNginxを規定したconfファイルの
rootの記述が悪いことが判明。
root /var/www/html/[laravelファイルのルートファイルの名前]/public
に変更しました。

docker/web/default.conf
server {
    listen 80;

    root  /var/www/html/[laravelファイルのルートファイルの名前]/public;
    index index.php index.html index.htm;

dockerを停止した後にもう一度起動します。

 $ docker-compose down

 $ docker-compose up -d

動いた!!!!

スクリーンショット 2019-11-03 0.16.13.png

28
7
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
28
7