How to upload your Laravel Website on Cpanel

Benson Arafat
3 min readJun 29, 2022

In this article, I will be sharing with you how you can publish your Laravel website on Cpanel.

With these few steps, you will be able to have your site fully functional online, You can also watch the video above for a virtual practice.

1. Compress Laravel files

Compress all your files

2. Upload on Cpanel

Upload the compressed files to the directory your site is located.

3. Extract files

Next, all you have to do is to extract the files

4. Create a folder called Core

At the top left corner, you can create a new folder, for the sake of this tutorial we will call this folder core.

5. Move all files

Now that we have our core folder, we can select all files (except the core folder we just created) and move them all into the core folder.

6. The Public folder

Next, we move into the public folder which is now inside the core folder. Our public folder will look something like this depending on what it contains.

All we have to do is to select all the files and move them to the root folder of our directory. The root folder (or root directory) is the top-level directory of a file system. Now we will have this on our root folder.

Lastly, one final step finishing everything up. All we have to do is to open the index.php page by right-clicking and then click on the edit option.

Now, you have a live editor open. All you have to do is change the files directory to the new location we now have.

They are three(3) lines of code we have to change.

if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
require $maintenance;
}

It will be changed to

if (file_exists($maintenance = __DIR__.'/core/storage/framework/maintenance.php')) {
require $maintenance;
}

Next

require __DIR__.'/../vendor/autoload.php';

It will be changed to

require __DIR__.'/core/vendor/autoload.php';

Lastly

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

changed to

$app = require_once __DIR__.'/core/bootstrap/app.php';

You will notice all we just did was just add the core folder.

Oh yeah. test your site now. You can see your site is now live.

Have any questions, you can leave is below the comment section, i will be very happy to help.

Thanks.

--

--