ByteBlog | Bytenaija Blog
Deploying Laravel 5 Applications on Shared Hosting Part 1

Deploying Laravel 5 Applications on Shared Hosting Part 1

After successfully developing your laravel application, you most definitely will start thinking of where to deploy your application. It happened to me a few hours ago when I decided to host this blog. This blog post list the steps you can take to successfully deploy your laravel application on shared hosting the way I successfully did.

Shared Hosting vs VPS

Deploying a Laravel application on a shared host is never recommended. It will be better to subscribe to a Virtual Private Server instead. Computing resources has become a lot cheaper recently and you could easily get a good VPS for less than 20 USD a month. If circumstances prevents you from using a VPS, like in situation where your client already have investments in a shared hosting account, the following explanation will get you through hosting your Laravel application on a shared host.

This article is in two parts.

  • The first part will discuss how to actually move your files to the server and ensure your server serves your files
  • The second part will discuss migrating your database from your localhost to your remote machine.

Let's get Started

You will need to use an FTP client to connect to your remote host. I will be using a free FTP client called FTP Voyager. You could use voyager or if you have Filezella installed go ahead and use that.

Enter your remote host FTP host and credentials into your preferred FTP client and connect.

Navigate to the root folder of your host - not the public_html

Create a folder* e.g. blog* in the root folder of your remote server and upload all the files and folders of your application except the public folder into the folder you just created.

Open the index.php file in your local folder and modify the following lines in the file from

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

 to

require __DIR__.'/../blog/bootstrap/autoload.php';
 ...
 $app = require_once __DIR__.'/../blog/bootstrap/app.php';

Change blog above to the name of the folder you created earlier

Then on the remote host, navigate to the public_html folder and upload everything including the .htaccess file in your local public folder into the public_html folder.

Go to your website now and test your application. You should either see the home page of your application, or you will get database errors if your homepage depends on calls to the database.

In the next part we will discuss how to set up your database connections and migrate your tables to your remote host.

If you have any question or comment, please enter them below and I will get back to you as soon as possible.

143 Comments

  • Jonelle 8 months ago

    Hi there, i read your blog from time to time and i own a similar one and i was just wondering if you get a lot of spam comments? If so how do you prevent it, any plugin or anything you can suggest? I get so much lately it's driving me crazy so any support is very much appreciated. I have been surfing on-line greater than three hours these days, yet I never found any fascinating article like yours. It is lovely price enough for me. Personally, if all webmasters and bloggers made good content as you probably did, the web might be much more useful than ever before. I am sure this piece of writing has touched all the internet viewers, its really really good post on building up new blog. http://foxnews.co.uk

  • Anton 8 months ago

    Hi! Quick question that's completely off topic.

    Do you know how to make your site mobile friendly? My blog looks weird when browsing from my apple iphone. I'm tryinng to find a theme or plugin that might be able to resolve this problem. If you have any recommendations, please share. With thanks!

  • Lynette 8 months ago

    The content inside the site needs to be written in a way that they'd be loved both through the search engines' spiders along with your visitors. Have you believed that it was possible to earn money online without paying anything. This often includes, book author, title, data, layout, color so on.