How to upload and host a Laravel project in the cPanel.

Laravel directory structure needs special attention as far as hosting in the cPanel is concerned. Proper uploading and hosting needs to be done to guarantee security of the application directories and files. This article gives a step by step guide on how to upload a Laravel app from a development environment like a local host to the cPanel for production.

Step I

Zip your project files so that you can upload a single zip file. After zipping the project files, login to the cpanel and create a new folder in the same level as the  “public_html” directory, as follows. Let us name it “mylaravel”;

To ensure that you are in the same level as public_html, start by clicking on the /home/domain username. Then use the “new folder” icon to create the folder.

Step II

After creating the “mylaravel” directory, open the directory and upload your zip file  in there.

Step III

Extract the zip files and move the contents of the “public” folder to public_html. 

This is how to move:

  • Open the app folder (mylaravel)
  • Select All the content.
  • Click on the Move button, that is among the top menu.
  • Enter the destination path, in this case /home/korirxyz/public_html

Step IV

In the public_html directory, edit the index.php  so that it includes the “mylravel” directory path, as follows;

Part 1

Part 2

Finally

Now go to your browser and load the domain name, your Laravel app should be up and running.

                                                END

Was this article helpful?

Related Articles

Leave A Comment?