How to deploy Laravel application on hostinger shared hosting?

How to deploy Laravel application on hostinger shared hosting?

Hello Artisans.

This article details how to deploy the Laravel application on hostinger shared hosting. I’m going to show you How to deploy Laravel on shared hosting. In this article, I will show you how to upload the laravel project to hostinger.

In this article, we will use Hostinger shared hosting to deploy our Laravel application with easy steps. So let's get started.

First, we need to make some changes in our Laravel application, we need to change the public folder name to public_html because many shared hosting provider's domain directory structure is public_html and we can't change it, so we need to make changes to our application to run our application on a live server without writing public keyword next to the domain name and run artisan commands as well.

Don't know how to change the public folder into public_html don't worry let's look at this article.

Read also: How to change the Laravel public folder to public_html

I assumed you have changed your public folder name into public_html, So, let's forward.

Step-1: Make zip file and upload on domain root directory

Make a zip file of your Laravel project and upload it to your domain's root directory then your root directory will look like this:

Blog Images

Step-2: Extract your zip file

Extract your zip file in the root directory then your directory will look like this after extracting your zip file.

Blog Images

cut all files into your application public folder and paste them into the public_html folder then you can remove your public folder as well.

Step-3: Create Database

Create a database for your uploaded Laravel project if you have any models in your applications.

Blog Images

Step-4: Configure Database in .env file

Add credentials of a newly created database in your .env file in your project located in the root directory.

Blog Images

Step-5: Run command php artisan migrate

Now it's time to run the essentials command to run the application properly.

Open your SSH terminal to run composer commands on the live server, if you don't know how to connect a live server with SSH, don't worry look at this article there it several ways to connect a live server with SSH access.

Read also: How to connect a live server with SSH access

I hope, now you are connected with SSH, let's run this command to migrate your database

php artisan migrate

run this command if you have any seeders file

php artisan migrate --seed

Hooray, now you can run your application with your domain name your-domain-name.com.

I hope it can help you.

Happy Coding :)

Leave a Comment

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

Go To Top
×