Posted on • Updated on

How to deploy laravel on shared hosting



Step 1 - ZIP your project and upload it to the outside domain root directory

Domain root directory e.g. public_html

Upload and Extract your project in /home/username/source

Step 2 - Move project public folder content to the domain root directory

/home/source/my-laravel-app/public -> /home/source/public_html

Step 3 - Edit /home/source/public_html/index.php and set up vendor and bootstrap folder path. 

| Register The Auto Loader
| Composer provides a convenient, automatically generated class loader for
| this application. We just need to utilize it! We'll simply require it
| into the script here so we don't need to manually load our classes.

require __DIR__.'/../source/my-laravel-app/vendor/autoload.php';

| Run The Application
| Once we have the application, we can handle the incoming request using
| the application's HTTP kernel. Then, we will send the response back
| to this client's browser, allowing them to enjoy our application.

$app = require_once __DIR__.'/../source/my-laravel-app/bootstrap/app.php';

Step 4 - Now 🚀 set up your project

  • Copy .env.example  .env
  • Edit .env according to your project needs

Step 5 - Link Storage

Create a symlink file under public_html



Call symlink.php 

💡 Checkout other methods to link storage folder

end of article

Related Posts

Join Our Newsletter

Want the latest & greatest from our blog straight to your inbox with some exclusive offers from our partners and sponsors?

We won't spam. Promise.