Guide on how to Deploy Laravel 5 on shared hosting
In this post, I’d like to show you how to deploy your Laravel 5 application, safe and secure on a shared hosting.
I’m assuming you have public_html directory, for example
/home/opeyemi/public_html
Now, create a new directory at the same level as your public_html, for example
/home/opeyemi/project
After creating this project[or whatever you name the directory].
You can now transfer your Laravel 5 code to the newly created directory.
At this point, your application is still not accessible incase you tried to view on your browser.
To make your project accessible, the first step is to copy all contents inside the /home/opeyemi/project/ folder to /home/opeyemi/public_html/ .
Next step is to modify the index.php inside the /home/opeyemi/public_html/, find the following line of code ` require DIR.’/../bootstrap/autoload.php’; $app = require_once DIR.’/../bootstrap/app.php’; `
Update the line of code to the correct paths as following
require __DIR__.'/../project/bootstrap/autoload.php';
$app = require_once __DIR__.'/../project/bootstrap/app.php';
After modifying the index.php file, don’t forget to configure your application variables in /home/opeyemi/project/.env
Yes!! Everything should work fine now
P.S Dont’ forget to copy the .htaccess to /home/opeyemi/public_html