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.

Laravel アプリケーションをHerokuにデプロイしてみた

Last updated at Posted at 2022-10-30

Laravel Documents

環境設定

・php -v  PHP 8.1.6
・composer -V  Composer version 2.4.2
・git 0-version  git version 2.37.1.windows.1

image.png

Creating a Laravel application

terminal
    laravel new hello_laravel_heroku

    cd hello_laravel_heroku

image.png

image.png

Initializing a Git repository

terminal
    git init
    git add .
    git commit -m "new laravel project"

Deploying to Heroku

Creating a Procfile

terminal
    echo "web: vendor/bin/heroku-php-apache2 public/" > Procfile
    git add .
    git commit -m "Procfile for Heroku"

Creating a new application on Heroku

terminal
    heroku create

Setting a Laravel encryption key

terminal
    php artisan key:generate --show
    base64:(コード)
    heroku config:set APP_KEY=base64:(コード)

Pushing to Heroku

terminal
    git push heroku master
    heroku open

Complete Deploy:confetti_ball:

#Best Practices

Changing the log destination for production

terminal
    

DBの設定

terminal
    heroku addons:create cleardb:ignite

image.png

terminal
    // windows
    heroku config | findstr CLEARDB_DATABASE_URL
    mysql://(コード)

    heroku config:set DATABASE_URL='mysql://(コード)'

    heroku config:set DB_CONNECTION=mysql
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?