Categories : Laravel

In this tutorial I will be showing you how to deploy laravel project on cpanel hosting. If you want to speed up your laravel application before deploying project do step by step guide to improve laravel application article.

If you need help about your Laravel Project you can hire me. Contact me on Upwork or Contact page.

I used Laravel 9 but all versions have the same directory structure.

Lets start to deploy laravel application on shared cpanel hosting! Follow image tutorial for Laravel cpanel deployment!

Before you start you should install composer and npm packaces. If your project is ready to deploy you dont need to follow this part.

For composer packages

composer install

For NPM packages

Run those two command

npm install
npm run dev

Step One : You should zip all of your laravel application files.

Step Two : Create folder that is inside of your Laravel host (root directory) for laravel files. It should be not public directory.

Why we just dont upload all files into public_html folder?

Because laravel split public files and framework files into seperate folders because of security reasons. That is why we should create folder in root directory. And upload all files into this folder. If you do this correctly you dont need to edit .htaccess file for Laravel application.

Step Three : Unzip all files and edit .env file for configuring database settings. If you dont know how to create database and database user in cpanel follow this guide. Also you should import your sql file into this database from phpmyadmin.


Edit .env file

Step Four : Copy all files from public directory of laravel project to public_html directory of your hosting shared directory.

Step Five : Edit project paths in public_html/index.php file for new laravel project directory.

Leave a Reply

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