how do deploy the laravel application to bluehost server?

How to deploy the laravel application to the Bluehost server

Hi guys,

I am considering the laravel application is ready for release, and you want to deploy your application on the server. In this article, we deploy the laravel application to bluehost server. Follow the steps to deploy the laravel application.

Select the Best plan for your application

Bluehost is the best platform to host the laravel application. They provide 24*7 support. It gives fast and secure CDN service. You can select the best plan for your application with the domain URL. You can check out hosting plans.

Compress your application.

Go to the project folder and compress all files except vendor and npm_modules because the project compress size is too much. Now we are ready to upload your project on the Bluehost server. After uploading the compressed file, now extract it.

compress laravel application
compress laravel application
Upload compressed file
Upload compressed file

You are using GitHub for project version control. Add GitHub link. It fetches all project files.

Connect the Database to your application

Create a database for your application. Make database user credentials for the database.

Create Database through cpanel
Create Database through cpanel

Modify .env file

Change APP_URL, APP_ENV, DB_DATABASE, DB_USERNAME and DB_PASSWORD inside .env file. If your database is somewhere else, you change the DB_HOST, and DB_PORT variables.
(code)

APP_NAME=YOUR_APP_NAME
APP_ENV=ENVIRONMENT_VALUE
APP_KEY=base64:34GP2WetPaHXmHN12g8DG5++9OMF/rJ3DJbQ2OR9dw4=
APP_DEBUG=true
APP_URL=YOUR_URL

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1 
DB_PORT=3306
DB_DATABASE=YOUR_DATABASE_NAME
DB_USERNAME=YOUR_DATABASE_USERNAME
DB_PASSWORD=YOUR_DATABASE_PASSWORD

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

Permission to folders

You can set permission for the project folder. It will solve the permission issue.

sudo find . -type f -exec chmod 664 {} \;
sudo find . -type d -exec chmod 775 {} \;

Run the command to get packages

Run the below command to get the required package to execute the laravel application.

composer install

You are using different views of technology for your application like React, Vuejs or Angular, etc. Run the below command to get all required packages to compile the view code.

npm install

Link your storage folder & Run the migration

You run the following command to make a symlink of storage/app/public folder in the public folder.

php artisan storage:link

Run the migration command to make tables in the database.

php artisan migrate

Modify the index.php

Modify the index.php file from the public folder like below.

require __DIR__.'/../bootstrap/autoload.php'; 
... 
$app = require_once __DIR__.'/../bootstrap/app.php';

to

require __DIR__.'/../laravel50/bootstrap/autoload.php'; 
... 
$app = require_once __DIR__.'/../laravel50/bootstrap/app.php';

Some important Command to your application

It will help you to run your applications.

/// clear cache from application
php artisan cache:clear

/// clear config from application
php artisan config:clear

/// clear and store configs data inside the application
php artisan config:cache

/// clear route from application
php artisan route:clear

/// looks for all the classes it needs to include again. It just regenerates the list of all classes that need to have in the project.
composer dump-autoload

Now your application is ready to use on any browser. Check the CRUD operations of your application.

Now your user will easily connect to your application. Do you want to check which mail tools are best for your application? Click Here. I hope that this post (How to implement Bitbucket login in laravel) has clarified how to integrate the Socialite package in laravel and load the drivers. If you have questions, please leave a comment and I will respond as soon as possible.

Thank you for reading this article. Please share this article with your friend circle. That’s it for the day. Stay Connected!
Cheers

Loading

1 thought on “how do deploy the laravel application to bluehost server?”

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top