Laravel 5.4: メンテナンスモードの使い方、仕組み

メンテナンスモードの使い方

  • 開始
$ php artisan down
  • 復帰
    • Be right back.と表示される
php artisan up

メンテナンスモードの仕組み

  • storage/framework/down が存在していたらメンテナンスモードになっている
$ ls -la storage/framework/down
ls: cannot access 'storage/framework/down': No such file or directory

$ php artisan down
Application is now in maintenance mode.
$ ls -la storage/framework/down
-rw-r--r-- 1 vagrant vagrant 66 Feb 14 03:44 storage/framework/down

$ php artisan up
Application is now live.
$ ls -la storage/framework/down
ls: cannot access 'storage/framework/down': No such file or directory
  • メンテナンスページのテンプレート
    • vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/503.blade.php にある

TODO

  • 部分的にメンテナンスモードにできる?
  • あるIPだけ限定でアクセスさせることができる?

参照

Laravel 5 メンテナンスモード IP制限