Deploy Laravel application on Heroku


Recently I have tried that how to deploy mLaravel 5 application on Heroku, which is one of the most popular Cloud Platfom nowadays, and I really love to use it. There are a lot of guidelines out there but I have faced some problems and I would like to share it thus anyone can put their laravel project on the cloud without any troubles.


Prerequisites:

  • Prepare Laravel project
  • Create Heroku user account here.

Deploying to Heroku


1. Login to Heroku
First you need to login to Heroku via command line: 
$ heroku login
Enter your Heroku credentials:
Email: hoandq@scuti.asia
Password: ******
Logged in as hoandq@scuti.asia


2. Heroku create
Use the Heroku Toolbelt to initialize a new Heroku project:
$ heroku create
Creating quiet-falls-84273... done, stack is cedar-14
https://quiet-falls-84273.herokuapp.com/ | https://git.heroku.com/quiet-falls-84273.git
Git remote heroku added

3. Creating a Procfile
$ echo web: vendor/bin/heroku-php-apache2 public > Procfile
4. Setting Laravel encrytion key
$ heroku config:set APP_KEY=$(php artisan --no-ansi key:generate --show)

5. Pushing to Heroku
Now the neccessary setting is almost enough, you need to push project to heroku by following commands: 
$ git add .
$ git commit -m "deploy to hereku"
$ git push heroku master

6. Open your site
After you successfully deploy, you can open http://quiet-falls-84273.herokuapp.com/ on browser or type
 $ heroku open

Reference: 

Thank you!





If you liked this article

Let's subscribe the updates of Scuti!
Share on Google Plus

About Quang Hoan

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

2 Comments:

  1. Instead of Heroku, I would recommend using Cloudways. With this platform, there is no need to know how to host Laravel project manually. Because this platform provides pre-configured servers in just one click.

    ReplyDelete