0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Herokuを使用してlaravelアプリケーションのデプロイ

Posted at

はじめに

個人開発メモ📝
課題提出のため、Herokuを使用してlaravelアプリケーションのデプロイ作業を行ったので備忘録として残します。

Heroku

Herokuのサイト↓
https://dashboard.heroku.com/

・アカウント作成
・プロジェクト作成
・デプロイ作業
主にこれだけでした。

デプロイ後、ハマったエラー

ブラウザからアクセスすると、500エラーが出ており解決するため以下の記事を参考にさせていただきました。
https://qiita.com/mumucochimu/items/f233d6f6347747dde7f2

上記に変更したら、今度は
スクリーンショット 2023-12-01 3.04.00.png
500エラーのままですが、内容が出るようになりました。

エラーメッセージ
No application encryption key has been specified.
アプリケーションの暗号化キーが指定されていない。

laravelではセッションやクッキーの暗号化に使用するため、アプリケーションにキーを設定が必須です。
すでに、.envファイルに設定していましたがheroku側に反映されていなかったため起こったエラーでした。

herokuにAPP_KEYを反映させる方法

// アプリケーションのキーを生成するコマンド
php artisan key:generate

herokuのサイトでキーを登録する方法は、まずプロジェクトの上部にある設定画面に入ります。

スクリーンショット 2023-12-01 3.21.37.png

スクリーンショット 2023-12-01 3.22.26.png

スクリーンショット 2023-12-01 3.23.45.png

KEYにAPP_KEY、VALUEに生成したキーを貼り付けます。

キーの登録後

スクリーンショット 2023-12-01 3.28.16.png

無事、公開できました!

0
0
0

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?