How to Deploy a Laravel project on Cyberpanel.

Have a Question?
< All Topics
Print

How to Deploy a Laravel project on Cyberpanel.

Setup Laravel App on your domain

To install the Laravel application first you need to install PHP composer.

Go to the terminal and run the following command.

Open the website directory from the CLI

cd /home/domain.com

Replace domain.com with your actual domain for which you want to set up a laravel app.

Then run following command to install composer

composer create-project laravel/laravel laravel-app

(laravel-app) This could be any name which you want to use .

After installing the composer make a symbolic link that directs laravel-app/public_html.

First remove the public_html directory under the domain

Use following command

rm -fr public_html

Now create symbolic link to access laravel-app

Use following command

ln -s laravel-app/public public_html

The command  ” ln -s laravel-app/public public_html “ creates a symbolic link named public_html, which points to the directory laravel-app/public. This command is commonly used in Linux-based systems to create a symbolic link (shortcut) from one directory to another.

Now go to the /home/domain/ and remove the public

If Laravel application is encountering permission issues while trying to write logs or cache files

Use the following command to fix the permission.

Go to /home/domai.com/laravel-app/

cd /home/domain.com/laravel-app/

sudo chmod -R ugo+rw storage

If these files doesn’t exist under the directory then you have to create them manually.

Use following commands to create log files

touch /home/domain.com/laravel-app/storage/logs/laravel.log

then run the command to fix permission

sudo chmod -R ugo+rw storage

Now you will be able to access the Laravel app.

Table of Contents