参考文献
Laravelアプリをherokuで動かすチュートリアル
上記のリンク先を参考にしてデプロイしました。
Laravelプロジェクト作成
command
composer create-project --prefer-dist laravel/laravel test_laravel
ちなみに下記のコードの意味は、「リリース版、安定版をダウンロードします」と言う意味。
example
--prefer-dist
●参考文献
LARAVEL 5.6 のインストール
下記は好きな名前に変えて良い(example_laravelとか。今回はtest_laravel)
example
test_laravel
Gitでバージョン管理
command
git init
git add .
git commit -m 'create_app'
HTTPサーバー設定を作成
今回はApacheを設定する。
command
echo web: vendor/bin/heroku-php-apache2 public/ > Procfile
Procfileに「web: vendor/bin/heroku-php-apache2 public/」を書き込む
Herokuアプリケーションを作成してデプロイ
command
Heroku login
heroku create $(basename $(pwd))
Creating ⬢ test_laravel... !
▸ Name must start with a letter and can only contain lowercase letters, numbers, and dashes.
あれ。。。動かない。翻訳すると「名前は小文字か数字かダッシュのみにしてね」と言うことなので
command
heroku create testlaravel
Creating ⬢ testlaravel... !
▸ Name testlaravel is already taken
あれれ。すでに名前が使われているとな。うーん。じゃあこれにしよう。
command
heroku create sholovelaravel
Creating ⬢ sholovelaravel... done
https://sholovelaravel.herokuapp.com/ | https://git.heroku.com/sholovelaravel.git
これでOK!続きをやっていこう。
command
heroku config:set APP_KEY=$(php artisan --no-ansi key:generate --show)
git push heroku master
上のコマンドでAPP_KEYを設定していて、下のコマンドはherokuにデプロイするコマンド。
動作確認
command
heroku open
これでひとまず完成!!明日はDB入れるところからかな。