How to install Laravel on shared hosting

Goes over the steps to secure your laravel application when using shared hosting

To securely use laravel on shared hosting, it’s important to separate the public folder. This secures the environment file etc.

  1. Create a folder outside of your public_html folder, called application.
  2. To this newly created folder you upload all but the public folder to. This is where your app, resources, storage etc. will now be located.
  3. Go to your public_html folder, and upload the contents of your public folder.
  4. Edit the file called index.php and locate this piece of code.
    require __DIR__.'/../vendor/autoload.php';
    And replace it with the following.
    require __DIR__.'/../application/vendor/autoload.php';
    Do the same for bootstrapping, replace the below.
    $app = require_once __DIR__.'/../bootstrap/app.php';
    With the following.
    $app = require_once __DIR__.'/../application/bootstrap/app.php';
  5. At last go back to the application folder, and edit the permissions of the storage folder by right clicking. Set permissions recursively to 777. This folder is for cache, files, logs etc. and must be accessible by the system.

The application is now secure.


Last update: 2018-05-21 20:20:57

Read more about Laravel

Can't find what you're looking for?

Open Ticket