Upload Laravel Project To Shared Hosting or Server
We can easily make Laravel project live in shared hosting or server. Let’s follow these steps:
Table of Contents
Step 1 : Compress Project Files
Go to your Laravel project directory. We need to make two zip files. Make one zip file without public folder and named as ‘framework.zip’. Then navigate to public folder and zip the contents as ‘public.zip‘.
Project files and folders:
Step 2 : Upload Zip Files to Hosting
Login to your web hosting CPanel and navigate to the root folder. Normally for all shared hosting the root folder is public_html. Then upload the zip files using File Manager.
Uploaded zip files:
Step 3 : Extract Zip Files
Now right click on ‘public.zip‘ file and Extract it.
After extracting public.zip, make a folder named “framework” and move the framework.zip file to that directory. Then extract framewrok.zip like public.zip. After extracting, delete those zip files.
So, the file structure look likes:
Step 4 : Config index.php
We are about to finish. Now we need to modify two lines (24 & 38) of the index.php. Open index.php and change like this:
----- require __DIR__.'/framework/vendor/autoload.php'; ----- $app = require_once __DIR__.'/framework/bootstrap/app.php';
That’s it. Now just visit your website URL to see the project. ?
Note For Server
For the server, you need to do the same things. You can connect to your server using FileZilla and follow those steps. You can also unzip easily via SSH.
Login to your server using SSH. Then go to the root directory and type this command to unzip:
If zip, unzip not installed on your server, type this to install zip, unzip:
We are done. Thank you. ?
# CentOS sudo yum install zip unzip # Ubuntu sudo apt-get install zip unzip
Preview may take a few seconds to load.
Below you will find some common used markdown syntax. For a deeper dive in Markdown check out this Cheat Sheet
Bold & Italic
Bold **double asterisks**
Three back ticks and then enter your code blocks here.
# This is a Heading 1
## This is a Heading 2
### This is a Heading 3
> type a greater than sign and start typing your quote.
You can add links by adding text inside of  and the link inside of (), like so:
To add a numbered list you can simply start with a number and a ., like so:
1. The first item in my list
For an unordered list, you can add a dash -, like so:
- The start of my list
You can add images by selecting the image icon, which will upload and add an image to the editor, or you can manually add the image by adding an exclamation !, followed by the alt text inside of , and the image URL inside of (), like so:
To add a divider you can add three dashes or three asterisks:
--- or ***